This commit is contained in:
Flatlogic Bot 2026-02-01 01:56:52 +00:00
parent 1be08434cd
commit cb3414f60c
18 changed files with 422 additions and 188 deletions

View File

@ -180,3 +180,7 @@ if EMAIL_USE_SSL:
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
MEDIA_URL = 'media/'
MEDIA_ROOT = BASE_DIR / 'media'

View File

@ -27,3 +27,8 @@ urlpatterns = [
if settings.DEBUG:
urlpatterns += static("/assets/", document_root=settings.BASE_DIR / "assets")
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
else:
# Always serve assets in this environment as they are stored in BASE_DIR / "assets"
urlpatterns += static("/assets/", document_root=settings.BASE_DIR / "assets")
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

View File

@ -1,3 +1,14 @@
from django.contrib import admin
from .models import Letter, Student
# Register your models here.
@admin.register(Letter)
class LetterAdmin(admin.ModelAdmin):
list_display = ('letter_number', 'subject', 'type', 'date', 'sender_receiver')
list_filter = ('type', 'date')
search_fields = ('letter_number', 'subject', 'sender_receiver')
@admin.register(Student)
class StudentAdmin(admin.ModelAdmin):
list_display = ('nisn', 'full_name', 'gender', 'is_active')
list_filter = ('gender', 'is_active')
search_fields = ('nisn', 'full_name')

View File

@ -0,0 +1,45 @@
# Generated by Django 5.2.7 on 2026-02-01 01:49
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Letter',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('type', models.CharField(choices=[('IN', 'Surat Masuk'), ('OUT', 'Surat Keluar')], default='IN', max_length=3)),
('subject', models.CharField(max_length=255)),
('letter_number', models.CharField(max_length=100, unique=True)),
('date', models.DateField(default=django.utils.timezone.now)),
('sender_receiver', models.CharField(help_text='Pengirim untuk Surat Masuk, Penerima untuk Surat Keluar', max_length=255)),
('description', models.TextField(blank=True, null=True)),
('file_attachment', models.FileField(blank=True, null=True, upload_to='letters/')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
),
migrations.CreateModel(
name='Student',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nisn', models.CharField(max_length=20, unique=True)),
('full_name', models.CharField(max_length=255)),
('gender', models.CharField(choices=[('M', 'Laki-laki'), ('F', 'Perempuan')], max_length=1)),
('birth_place', models.CharField(max_length=100)),
('birth_date', models.DateField()),
('address', models.TextField()),
('is_active', models.BooleanField(default=True)),
('photo', models.ImageField(blank=True, null=True, upload_to='students/')),
('created_at', models.DateTimeField(auto_now_add=True)),
],
),
]

View File

@ -1,3 +1,40 @@
from django.db import models
from django.utils import timezone
# Create your models here.
class Letter(models.Model):
LETTER_TYPE_CHOICES = [
('IN', 'Surat Masuk'),
('OUT', 'Surat Keluar'),
]
type = models.CharField(max_length=3, choices=LETTER_TYPE_CHOICES, default='IN')
subject = models.CharField(max_length=255)
letter_number = models.CharField(max_length=100, unique=True)
date = models.DateField(default=timezone.now)
sender_receiver = models.CharField(max_length=255, help_text="Pengirim untuk Surat Masuk, Penerima untuk Surat Keluar")
description = models.TextField(blank=True, null=True)
file_attachment = models.FileField(upload_to='letters/', blank=True, null=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return f"[{self.get_type_display()}] {self.letter_number} - {self.subject}"
class Student(models.Model):
GENDER_CHOICES = [
('M', 'Laki-laki'),
('F', 'Perempuan'),
]
nisn = models.CharField(max_length=20, unique=True)
full_name = models.CharField(max_length=255)
gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
birth_place = models.CharField(max_length=100)
birth_date = models.DateField()
address = models.TextField()
is_active = models.BooleanField(default=True)
photo = models.ImageField(upload_to='students/', blank=True, null=True)
created_at = models.DateTimeField(auto_now_add=True)
def __str__(self):
return f"{self.nisn} - {self.full_name}"

View File

@ -1,9 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<html lang="id">
{% load static %}
<head>
<meta charset="UTF-8">
<title>{% block title %}Knowledge Base{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}SIMSBI - Sistem Informasi Manajemen Surat & Buku Induk{% endblock %}</title>
{% if project_description %}
<meta name="description" content="{{ project_description }}">
<meta property="og:description" content="{{ project_description }}">
@ -13,13 +15,53 @@
<meta property="og:image" content="{{ project_image_url }}">
<meta property="twitter:image" content="{{ project_image_url }}">
{% endif %}
{% load static %}
<!-- Fonts -->
<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;600;700&family=Playfair+Display:wght@700;800&display=swap" rel="stylesheet">
<!-- Bootstrap 5 -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
{% block head %}{% endblock %}
</head>
<body>
{% block content %}{% endblock %}
<nav class="navbar navbar-expand-lg sticky-top">
<div class="container">
<a class="navbar-brand" href="{% url 'index' %}">SIMSBI</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
<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' %}">Dashboard</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/admin/">Admin Panel</a>
</li>
</ul>
</div>
</div>
</nav>
<main>
{% block content %}{% endblock %}
</main>
<footer class="py-4 mt-5 bg-white border-top">
<div class="container text-center">
<p class="mb-0 text-muted">&copy; 2026 SIMSBI - Sistem Informasi Manajemen Sekolah Digital</p>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
{% block scripts %}{% endblock %}
</body>
</html>

View File

@ -1,145 +1,110 @@
{% extends "base.html" %}
{% 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 %}
{% extends 'base.html' %}
{% load static %}
{% 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>
<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>
<section class="hero-section">
<div class="container text-center">
<h1 class="display-4 mb-3">Selamat Datang di SIMSBI</h1>
<p class="lead opacity-75">Sistem Informasi Manajemen Surat & Buku Induk Siswa Digital Terintegrasi</p>
</div>
</main>
<footer>
Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC)
</footer>
{% endblock %}
</section>
<div class="container">
<div class="row g-4 mb-5">
<div class="col-md-3">
<div class="card stat-card p-4 text-center">
<h3 class="h1 mb-0">{{ total_letters }}</h3>
<p class="text-muted mb-0">Total Surat</p>
</div>
</div>
<div class="col-md-3">
<div class="card stat-card p-4 text-center border-start border-success border-4">
<h3 class="h1 mb-0 text-success">{{ letters_in }}</h3>
<p class="text-muted mb-0">Surat Masuk</p>
</div>
</div>
<div class="col-md-3">
<div class="card stat-card p-4 text-center border-start border-danger border-4">
<h3 class="h1 mb-0 text-danger">{{ letters_out }}</h3>
<p class="text-muted mb-0">Surat Keluar</p>
</div>
</div>
<div class="col-md-3">
<div class="card stat-card p-4 text-center border-start border-primary border-4">
<h3 class="h1 mb-0 text-primary">{{ total_students }}</h3>
<p class="text-muted mb-0">Total Siswa</p>
</div>
</div>
</div>
<div class="row g-4">
<div class="col-lg-8">
<div class="card p-4 mb-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<h3 class="h4 mb-0">Surat Terbaru</h3>
<a href="/admin/core/letter/add/" class="btn btn-primary btn-sm">+ Input Surat</a>
</div>
<div class="table-responsive">
<table class="table align-middle">
<thead>
<tr>
<th>No. Surat</th>
<th>Perihal</th>
<th>Tipe</th>
<th>Tanggal</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
{% for letter in recent_letters %}
<tr>
<td><strong>{{ letter.letter_number }}</strong></td>
<td>{{ letter.subject }}</td>
<td>
<span class="badge {% if letter.type == 'IN' %}badge-in{% else %}badge-out{% endif %}">
{{ letter.get_type_display }}
</span>
</td>
<td>{{ letter.date|date:"d M Y" }}</td>
<td>
<a href="/admin/core/letter/{{ letter.id }}/change/" class="btn btn-outline-secondary btn-sm">Detail</a>
</td>
</tr>
{% empty %}
<tr>
<td colspan="5" class="text-center py-4 text-muted">Belum ada data surat.</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card p-4 h-100">
<h3 class="h4 mb-4">Akses Cepat</h3>
<div class="list-group list-group-flush">
<a href="/admin/core/letter/" class="list-group-item list-group-item-action py-3 border-0 rounded mb-2 bg-light">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1 h6">Kelola Surat</h5>
</div>
<p class="mb-1 small text-muted">Arsip surat masuk & keluar.</p>
</a>
<a href="/admin/core/student/" class="list-group-item list-group-item-action py-3 border-0 rounded mb-2 bg-light">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1 h6">Buku Induk</h5>
</div>
<p class="mb-1 small text-muted">Data induk siswa lengkap.</p>
</a>
<a href="/admin/core/letter/add/" class="list-group-item list-group-item-action py-3 border-0 rounded mb-2 bg-light">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1 h6">Input Surat Baru</h5>
</div>
<p class="mb-1 small text-muted">Catat administrasi persuratan.</p>
</a>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -1,7 +1,6 @@
from django.urls import path
from .views import home
from .views import index
urlpatterns = [
path("", home, name="home"),
]
path("", index, name="index"),
]

View File

@ -1,25 +1,28 @@
import os
import platform
from django import get_version as django_version
from django.shortcuts import render
from django.utils import timezone
from .models import Letter, Student
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"
def index(request):
"""Render the SIMSBI dashboard."""
now = timezone.now()
# Simple stats
total_letters = Letter.objects.count()
letters_in = Letter.objects.filter(type='IN').count()
letters_out = Letter.objects.filter(type='OUT').count()
total_students = Student.objects.count()
recent_letters = Letter.objects.all().order_by('-created_at')[:5]
context = {
"project_name": "New Style",
"agent_brand": agent_brand,
"django_version": django_version(),
"python_version": platform.python_version(),
"project_name": "SIMSBI",
"total_letters": total_letters,
"letters_in": letters_in,
"letters_out": letters_out,
"total_students": total_students,
"recent_letters": recent_letters,
"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)

View File

@ -1,4 +1,74 @@
/* Custom styles for the application */
body {
font-family: system-ui, -apple-system, sans-serif;
/* SIMSBI Custom Styles */
:root {
--primary-color: #10b981; /* Emerald 500 */
--primary-hover: #059669; /* Emerald 600 */
--secondary-color: #1e293b; /* Slate 800 */
--accent-color: #3b82f6; /* Blue 500 */
--bg-light: #f8fafc; /* Slate 50 */
--card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}
body {
font-family: 'Inter', sans-serif;
background-color: var(--bg-light);
color: var(--secondary-color);
}
h1, h2, h3, h4, .brand-font {
font-family: 'Playfair Display', serif;
font-weight: 700;
}
.navbar {
background-color: white;
border-bottom: 1px solid #e2e8f0;
}
.navbar-brand {
color: var(--primary-color) !important;
font-weight: 800;
font-size: 1.5rem;
}
.btn-primary {
background-color: var(--primary-color);
border-color: var(--primary-color);
}
.btn-primary:hover {
background-color: var(--primary-hover);
border-color: var(--primary-hover);
}
.card {
border: none;
border-radius: 12px;
box-shadow: var(--card-shadow);
}
.stat-card {
transition: transform 0.2s;
}
.stat-card:hover {
transform: translateY(-5px);
}
.hero-section {
background: linear-gradient(135deg, #10b981 0%, #059669 100%);
color: white;
padding: 60px 0;
border-radius: 0 0 24px 24px;
margin-bottom: 40px;
}
.table thead th {
background-color: #f1f5f9;
border-bottom: 2px solid #e2e8f0;
text-transform: uppercase;
font-size: 0.75rem;
letter-spacing: 0.05em;
}
.badge-in { background-color: #dcfce7; color: #166534; }
.badge-out { background-color: #fee2e2; color: #991b1b; }

View File

@ -1,21 +1,74 @@
/* SIMSBI Custom Styles */
: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);
--primary-color: #10b981; /* Emerald 500 */
--primary-hover: #059669; /* Emerald 600 */
--secondary-color: #1e293b; /* Slate 800 */
--accent-color: #3b82f6; /* Blue 500 */
--bg-light: #f8fafc; /* Slate 50 */
--card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}
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;
background-color: var(--bg-light);
color: var(--secondary-color);
}
h1, h2, h3, h4, .brand-font {
font-family: 'Playfair Display', serif;
font-weight: 700;
}
.navbar {
background-color: white;
border-bottom: 1px solid #e2e8f0;
}
.navbar-brand {
color: var(--primary-color) !important;
font-weight: 800;
font-size: 1.5rem;
}
.btn-primary {
background-color: var(--primary-color);
border-color: var(--primary-color);
}
.btn-primary:hover {
background-color: var(--primary-hover);
border-color: var(--primary-hover);
}
.card {
border: none;
border-radius: 12px;
box-shadow: var(--card-shadow);
}
.stat-card {
transition: transform 0.2s;
}
.stat-card:hover {
transform: translateY(-5px);
}
.hero-section {
background: linear-gradient(135deg, #10b981 0%, #059669 100%);
color: white;
padding: 60px 0;
border-radius: 0 0 24px 24px;
margin-bottom: 40px;
}
.table thead th {
background-color: #f1f5f9;
border-bottom: 2px solid #e2e8f0;
text-transform: uppercase;
font-size: 0.75rem;
letter-spacing: 0.05em;
}
.badge-in { background-color: #dcfce7; color: #166534; }
.badge-out { background-color: #fee2e2; color: #991b1b; }