Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2b6515ab1 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
27
core/migrations/0001_initial.py
Normal file
27
core/migrations/0001_initial.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Generated by Django 5.2.7 on 2026-01-21 10:54
|
||||||
|
|
||||||
|
import django.utils.timezone
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Farm',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(max_length=200, verbose_name='Farm Name')),
|
||||||
|
('owner_name', models.CharField(max_length=200, verbose_name='Owner Name')),
|
||||||
|
('location', models.CharField(max_length=300, verbose_name='Location/Address')),
|
||||||
|
('size_hectares', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Size (Hectares)')),
|
||||||
|
('registration_date', models.DateTimeField(default=django.utils.timezone.now)),
|
||||||
|
('status', models.CharField(choices=[('active', 'Active'), ('pending', 'Pending Inspection'), ('suspended', 'Suspended')], default='pending', max_length=20)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
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.
@ -1,3 +1,22 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
# Create your models here.
|
class Farm(models.Model):
|
||||||
|
STATUS_CHOICES = [
|
||||||
|
('active', 'Active'),
|
||||||
|
('pending', 'Pending Inspection'),
|
||||||
|
('suspended', 'Suspended'),
|
||||||
|
]
|
||||||
|
|
||||||
|
name = models.CharField(max_length=200, verbose_name="Farm Name")
|
||||||
|
owner_name = models.CharField(max_length=200, verbose_name="Owner Name")
|
||||||
|
location = models.CharField(max_length=300, verbose_name="Location/Address")
|
||||||
|
size_hectares = models.DecimalField(max_digits=10, decimal_places=2, verbose_name="Size (Hectares)")
|
||||||
|
registration_date = models.DateTimeField(default=timezone.now)
|
||||||
|
status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='pending')
|
||||||
|
|
||||||
|
# Placeholder for future relation to User
|
||||||
|
# owner = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
@ -1,25 +1,106 @@
|
|||||||
|
{% load static %}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>{% block title %}Knowledge Base{% endblock %}</title>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
{% if project_description %}
|
<title>{% block title %}AGRO LINK CENTER{% endblock %}</title>
|
||||||
<meta name="description" content="{{ project_description }}">
|
|
||||||
<meta property="og:description" content="{{ project_description }}">
|
<!-- Fonts -->
|
||||||
<meta property="twitter:description" content="{{ project_description }}">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
{% endif %}
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
{% if project_image_url %}
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Roboto:wght@400;500&display=swap" rel="stylesheet">
|
||||||
<meta property="og:image" content="{{ project_image_url }}">
|
|
||||||
<meta property="twitter:image" content="{{ project_image_url }}">
|
<!-- Bootstrap 5 -->
|
||||||
{% endif %}
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
{% load static %}
|
<!-- Font Awesome -->
|
||||||
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
||||||
|
<!-- Custom CSS -->
|
||||||
|
<link rel="stylesheet" href="{% static 'css/custom.css' %}">
|
||||||
|
|
||||||
{% block head %}{% endblock %}
|
{% block head %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{% block content %}{% endblock %}
|
|
||||||
</body>
|
|
||||||
|
|
||||||
|
<!-- Sidebar -->
|
||||||
|
<nav class="sidebar">
|
||||||
|
<div class="sidebar-brand">
|
||||||
|
<i class="fas fa-leaf"></i>
|
||||||
|
<span>AGRO LINK</span>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex flex-column py-3">
|
||||||
|
<a href="{% url 'dashboard' %}" class="nav-link {% if request.resolver_match.url_name == 'dashboard' %}active{% endif %}">
|
||||||
|
<i class="fas fa-th-large"></i> Dashboard
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="text-uppercase small text-muted px-4 mt-3 mb-2">Management Modules</div>
|
||||||
|
|
||||||
|
<a href="#" class="nav-link">
|
||||||
|
<i class="fas fa-id-card"></i> Registration & KYC
|
||||||
|
</a>
|
||||||
|
<a href="#" class="nav-link">
|
||||||
|
<i class="fas fa-tractor"></i> Farm Licenses
|
||||||
|
</a>
|
||||||
|
<a href="#" class="nav-link">
|
||||||
|
<i class="fas fa-chart-pie"></i> Quota Mgmt
|
||||||
|
</a>
|
||||||
|
<a href="#" class="nav-link">
|
||||||
|
<i class="fas fa-ship"></i> Trade (Imp/Exp)
|
||||||
|
</a>
|
||||||
|
<a href="#" class="nav-link">
|
||||||
|
<i class="fas fa-seedling"></i> E-Phytosanitary
|
||||||
|
</a>
|
||||||
|
<a href="#" class="nav-link">
|
||||||
|
<i class="fas fa-industry"></i> Processing Plants
|
||||||
|
</a>
|
||||||
|
<a href="#" class="nav-link">
|
||||||
|
<i class="fas fa-tree"></i> Forest Mgmt
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="mt-auto px-4 pb-4">
|
||||||
|
<div class="p-3 bg-light rounded text-center">
|
||||||
|
<small class="d-block text-muted">Logged in as</small>
|
||||||
|
<strong>Admin</strong>
|
||||||
|
<a href="#" class="d-block small text-danger mt-1">Logout</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<!-- Main Content -->
|
||||||
|
<main class="main-content">
|
||||||
|
<!-- Header -->
|
||||||
|
<header class="d-flex justify-content-between align-items-center mb-4 pb-3 border-bottom">
|
||||||
|
<div>
|
||||||
|
<h2 class="h4 mb-0">{% block page_title %}Overview{% endblock %}</h2>
|
||||||
|
<small class="text-muted">Welcome to Agro Link Center Management System</small>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex align-items-center gap-3">
|
||||||
|
<button class="btn btn-light position-relative">
|
||||||
|
<i class="fas fa-bell"></i>
|
||||||
|
<span class="position-absolute top-0 start-100 translate-middle p-1 bg-danger border border-light rounded-circle"></span>
|
||||||
|
</button>
|
||||||
|
<a href="/admin/" class="btn btn-outline-secondary btn-sm">
|
||||||
|
<i class="fas fa-cogs"></i> System Admin
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- Messages -->
|
||||||
|
{% if messages %}
|
||||||
|
{% for message in messages %}
|
||||||
|
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
|
||||||
|
{{ message }}
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% endblock %}
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
{% block scripts %}{% endblock %}
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
49
core/templates/core/farm_form.html
Normal file
49
core/templates/core/farm_form.html
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block page_title %}Register New Farm{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="card border-0 shadow-sm rounded-4">
|
||||||
|
<div class="card-body p-4">
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label fw-bold">Farm Name</label>
|
||||||
|
{{ form.name }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-bold">Owner Name</label>
|
||||||
|
{{ form.owner_name }}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-bold">Size (Hectares)</label>
|
||||||
|
{{ form.size_hectares }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label fw-bold">Location / Address</label>
|
||||||
|
{{ form.location }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<label class="form-label fw-bold">Initial Status</label>
|
||||||
|
{{ form.status }}
|
||||||
|
<div class="form-text">Newly registered farms are usually set to 'Pending Inspection'.</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex gap-2 justify-content-end">
|
||||||
|
<a href="{% url 'dashboard' %}" class="btn btn-light">Cancel</a>
|
||||||
|
<button type="submit" class="btn btn-primary px-4">Register Farm</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@ -1,145 +1,112 @@
|
|||||||
{% 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 content %}
|
{% block content %}
|
||||||
<main>
|
<div class="row g-4 mb-4">
|
||||||
<div class="card">
|
<!-- Stat Card 1 -->
|
||||||
<h1>Analyzing your requirements and generating your app…</h1>
|
<div class="col-md-4">
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<div class="stat-card p-4">
|
||||||
<span class="sr-only">Loading…</span>
|
<div class="d-flex justify-content-between align-items-start">
|
||||||
|
<div>
|
||||||
|
<h6 class="text-muted mb-1">Total Farms</h6>
|
||||||
|
<h2 class="mb-0">{{ total_farms }}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="stat-icon bg-light-green">
|
||||||
|
<i class="fas fa-tractor"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3 small text-muted">
|
||||||
|
<i class="fas fa-arrow-up text-success"></i> <span>12% from last month</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Stat Card 2 -->
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="stat-card p-4">
|
||||||
|
<div class="d-flex justify-content-between align-items-start">
|
||||||
|
<div>
|
||||||
|
<h6 class="text-muted mb-1">Active Licenses</h6>
|
||||||
|
<h2 class="mb-0">{{ active_farms }}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="stat-icon bg-light-blue">
|
||||||
|
<i class="fas fa-certificate"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3 small text-muted">
|
||||||
|
<span>Updated just now</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Stat Card 3 -->
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="stat-card p-4">
|
||||||
|
<div class="d-flex justify-content-between align-items-start">
|
||||||
|
<div>
|
||||||
|
<h6 class="text-muted mb-1">Pending Approval</h6>
|
||||||
|
<h2 class="mb-0">{{ pending_farms }}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="stat-icon bg-light-orange">
|
||||||
|
<i class="fas fa-clipboard-check"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3 small text-muted">
|
||||||
|
<span class="text-warning">Action required</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Recent Activity Section -->
|
||||||
|
<div class="card border-0 shadow-sm rounded-4">
|
||||||
|
<div class="card-header bg-white py-3 d-flex justify-content-between align-items-center">
|
||||||
|
<h5 class="mb-0">Recent Registered Farms</h5>
|
||||||
|
<a href="{% url 'farm_create' %}" class="btn btn-primary btn-sm">
|
||||||
|
<i class="fas fa-plus"></i> Register New Farm
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-0">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-custom table-hover mb-0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="ps-4">Farm Name</th>
|
||||||
|
<th>Owner</th>
|
||||||
|
<th>Location</th>
|
||||||
|
<th>Size (Ha)</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Registered</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for farm in recent_farms %}
|
||||||
|
<tr>
|
||||||
|
<td class="ps-4 fw-medium">{{ farm.name }}</td>
|
||||||
|
<td>{{ farm.owner_name }}</td>
|
||||||
|
<td>{{ farm.location }}</td>
|
||||||
|
<td>{{ farm.size_hectares }}</td>
|
||||||
|
<td>
|
||||||
|
<span class="badge-status
|
||||||
|
{% if farm.status == 'active' %}badge-active
|
||||||
|
{% elif farm.status == 'pending' %}badge-pending
|
||||||
|
{% else %}badge-suspended{% endif %}">
|
||||||
|
{{ farm.get_status_display }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td class="text-muted small">{{ farm.registration_date|date:"M d, Y" }}</td>
|
||||||
|
</tr>
|
||||||
|
{% empty %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="6" class="text-center py-5 text-muted">
|
||||||
|
<i class="fas fa-inbox fa-2x mb-3 d-block opacity-25"></i>
|
||||||
|
No farms registered yet.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</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>
|
</div>
|
||||||
</main>
|
|
||||||
<footer>
|
|
||||||
Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC)
|
|
||||||
</footer>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
from . import views
|
||||||
from .views import home
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", home, name="home"),
|
path('', views.dashboard, name='dashboard'),
|
||||||
|
path('farm/new/', views.farm_create, name='farm_create'),
|
||||||
]
|
]
|
||||||
@ -1,25 +1,50 @@
|
|||||||
import os
|
from django.shortcuts import render, redirect
|
||||||
import platform
|
from django.contrib import messages
|
||||||
|
from .models import Farm
|
||||||
|
from django import forms
|
||||||
|
|
||||||
from django import get_version as django_version
|
# Simple Form class (keeping it in views for speed, or separate file is fine too.
|
||||||
from django.shortcuts import render
|
# best practice is forms.py but for this task I'll stick to views or create forms.py if it gets complex.
|
||||||
from django.utils import timezone
|
# Let's create a forms.py to be clean).
|
||||||
|
|
||||||
|
class FarmForm(forms.ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = Farm
|
||||||
|
fields = ['name', 'owner_name', 'location', 'size_hectares', 'status']
|
||||||
|
widgets = {
|
||||||
|
'name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'e.g. Green Valley Farm'}),
|
||||||
|
'owner_name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'e.g. Somchai S.'}),
|
||||||
|
'location': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Province, District'}),
|
||||||
|
'size_hectares': forms.NumberInput(attrs={'class': 'form-control', 'step': '0.01'}),
|
||||||
|
'status': forms.Select(attrs={'class': 'form-select'}),
|
||||||
|
}
|
||||||
|
|
||||||
def home(request):
|
def dashboard(request):
|
||||||
"""Render the landing screen with loader and environment details."""
|
# Stats
|
||||||
host_name = request.get_host().lower()
|
total_farms = Farm.objects.count()
|
||||||
agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic"
|
active_farms = Farm.objects.filter(status='active').count()
|
||||||
now = timezone.now()
|
pending_farms = Farm.objects.filter(status='pending').count()
|
||||||
|
|
||||||
|
# Recent
|
||||||
|
recent_farms = Farm.objects.order_by('-registration_date')[:5]
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
"project_name": "New Style",
|
'total_farms': total_farms,
|
||||||
"agent_brand": agent_brand,
|
'active_farms': active_farms,
|
||||||
"django_version": django_version(),
|
'pending_farms': pending_farms,
|
||||||
"python_version": platform.python_version(),
|
'recent_farms': recent_farms,
|
||||||
"current_time": now,
|
'page_title': 'Overview'
|
||||||
"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 farm_create(request):
|
||||||
|
if request.method == 'POST':
|
||||||
|
form = FarmForm(request.POST)
|
||||||
|
if form.is_valid():
|
||||||
|
form.save()
|
||||||
|
messages.success(request, 'Farm registered successfully!')
|
||||||
|
return redirect('dashboard')
|
||||||
|
else:
|
||||||
|
form = FarmForm()
|
||||||
|
|
||||||
|
return render(request, 'core/farm_form.html', {'form': form, 'page_title': 'Register New Farm'})
|
||||||
@ -1,4 +1,144 @@
|
|||||||
/* Custom styles for the application */
|
/* AGRO LINK CENTER Custom Styles */
|
||||||
body {
|
|
||||||
font-family: system-ui, -apple-system, sans-serif;
|
:root {
|
||||||
|
--agro-primary: #2E7D32; /* Deep Green */
|
||||||
|
--agro-secondary: #81C784; /* Light Green */
|
||||||
|
--agro-accent: #FFC107; /* Amber for highlights */
|
||||||
|
--agro-bg: #F8F9FA;
|
||||||
|
--agro-text: #1C1C1E;
|
||||||
|
--sidebar-width: 260px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Roboto', sans-serif;
|
||||||
|
background-color: var(--agro-bg);
|
||||||
|
color: var(--agro-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1b4d20;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sidebar */
|
||||||
|
.sidebar {
|
||||||
|
width: var(--sidebar-width);
|
||||||
|
background: white;
|
||||||
|
height: 100vh;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
border-right: 1px solid #e0e0e0;
|
||||||
|
z-index: 1000;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-brand {
|
||||||
|
padding: 1.5rem;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--agro-primary);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-brand i {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-link {
|
||||||
|
color: #555;
|
||||||
|
padding: 0.8rem 1.5rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
transition: all 0.2s;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-link:hover, .nav-link.active {
|
||||||
|
background-color: #e8f5e9;
|
||||||
|
color: var(--agro-primary);
|
||||||
|
border-right: 3px solid var(--agro-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-link i {
|
||||||
|
width: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Main Content */
|
||||||
|
.main-content {
|
||||||
|
margin-left: var(--sidebar-width);
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Cards */
|
||||||
|
.stat-card {
|
||||||
|
background: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 12px;
|
||||||
|
box-shadow: 0 2px 12px rgba(0,0,0,0.04);
|
||||||
|
transition: transform 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-icon {
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
border-radius: 10px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-light-green { background-color: #E8F5E9; color: var(--agro-primary); }
|
||||||
|
.bg-light-blue { background-color: #E3F2FD; color: #1976D2; }
|
||||||
|
.bg-light-orange { background-color: #FFF3E0; color: #F57C00; }
|
||||||
|
|
||||||
|
/* Table */
|
||||||
|
.table-custom th {
|
||||||
|
background-color: #f9fafb;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #666;
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-custom td {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-status {
|
||||||
|
padding: 0.4em 0.8em;
|
||||||
|
border-radius: 20px;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.badge-active { background-color: #E8F5E9; color: #2E7D32; }
|
||||||
|
.badge-pending { background-color: #FFF3E0; color: #EF6C00; }
|
||||||
|
.badge-suspended { background-color: #FFEBEE; color: #C62828; }
|
||||||
|
|
||||||
|
/* Button */
|
||||||
|
.btn-primary {
|
||||||
|
background-color: var(--agro-primary);
|
||||||
|
border-color: var(--agro-primary);
|
||||||
|
}
|
||||||
|
.btn-primary:hover {
|
||||||
|
background-color: #1b4d20;
|
||||||
|
border-color: #1b4d20;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mobile responsive */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.sidebar { transform: translateX(-100%); transition: transform 0.3s; }
|
||||||
|
.main-content { margin-left: 0; }
|
||||||
|
.sidebar.show { transform: translateX(0); }
|
||||||
}
|
}
|
||||||
@ -1,21 +1,144 @@
|
|||||||
|
/* AGRO LINK CENTER Custom Styles */
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--bg-color-start: #6a11cb;
|
--agro-primary: #2E7D32; /* Deep Green */
|
||||||
--bg-color-end: #2575fc;
|
--agro-secondary: #81C784; /* Light Green */
|
||||||
--text-color: #ffffff;
|
--agro-accent: #FFC107; /* Amber for highlights */
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
--agro-bg: #F8F9FA;
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
--agro-text: #1C1C1E;
|
||||||
|
--sidebar-width: 260px;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
font-family: 'Roboto', sans-serif;
|
||||||
font-family: 'Inter', sans-serif;
|
background-color: var(--agro-bg);
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
color: var(--agro-text);
|
||||||
color: var(--text-color);
|
}
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
h1, h2, h3, h4, h5, h6 {
|
||||||
align-items: center;
|
font-family: 'Inter', sans-serif;
|
||||||
min-height: 100vh;
|
font-weight: 600;
|
||||||
text-align: center;
|
color: #1b4d20;
|
||||||
overflow: hidden;
|
}
|
||||||
position: relative;
|
|
||||||
|
/* Sidebar */
|
||||||
|
.sidebar {
|
||||||
|
width: var(--sidebar-width);
|
||||||
|
background: white;
|
||||||
|
height: 100vh;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
border-right: 1px solid #e0e0e0;
|
||||||
|
z-index: 1000;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-brand {
|
||||||
|
padding: 1.5rem;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--agro-primary);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-brand i {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-link {
|
||||||
|
color: #555;
|
||||||
|
padding: 0.8rem 1.5rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
transition: all 0.2s;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-link:hover, .nav-link.active {
|
||||||
|
background-color: #e8f5e9;
|
||||||
|
color: var(--agro-primary);
|
||||||
|
border-right: 3px solid var(--agro-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-link i {
|
||||||
|
width: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Main Content */
|
||||||
|
.main-content {
|
||||||
|
margin-left: var(--sidebar-width);
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Cards */
|
||||||
|
.stat-card {
|
||||||
|
background: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 12px;
|
||||||
|
box-shadow: 0 2px 12px rgba(0,0,0,0.04);
|
||||||
|
transition: transform 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-icon {
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
border-radius: 10px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-light-green { background-color: #E8F5E9; color: var(--agro-primary); }
|
||||||
|
.bg-light-blue { background-color: #E3F2FD; color: #1976D2; }
|
||||||
|
.bg-light-orange { background-color: #FFF3E0; color: #F57C00; }
|
||||||
|
|
||||||
|
/* Table */
|
||||||
|
.table-custom th {
|
||||||
|
background-color: #f9fafb;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #666;
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-custom td {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-status {
|
||||||
|
padding: 0.4em 0.8em;
|
||||||
|
border-radius: 20px;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.badge-active { background-color: #E8F5E9; color: #2E7D32; }
|
||||||
|
.badge-pending { background-color: #FFF3E0; color: #EF6C00; }
|
||||||
|
.badge-suspended { background-color: #FFEBEE; color: #C62828; }
|
||||||
|
|
||||||
|
/* Button */
|
||||||
|
.btn-primary {
|
||||||
|
background-color: var(--agro-primary);
|
||||||
|
border-color: var(--agro-primary);
|
||||||
|
}
|
||||||
|
.btn-primary:hover {
|
||||||
|
background-color: #1b4d20;
|
||||||
|
border-color: #1b4d20;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mobile responsive */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.sidebar { transform: translateX(-100%); transition: transform 0.3s; }
|
||||||
|
.main-content { margin-left: 0; }
|
||||||
|
.sidebar.show { transform: translateX(0); }
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user