Spaces:
Running
ออกแบบเว็บไซต์ HTML5 (Single Page, Mobile-First, Responsive) สำหรับ “แพลตฟอร์มเกษตรอัจฉริยะ – ใจเกษตร Smart Farm” เวอร์ชันภาษาไทย ใช้ได้บนมือถือ 100% พร้อม Mockup ข้อมูลจริงในทุกฟีเจอร์
Browse files**คอนเซปต์:** ใช้โทนสี “เขียวพืช”, “น้ำตาลดิน”, “ขาวสะอาด”
ฟอนต์: Prompt (ภาษาไทย)
เน้น UX เข้าใจง่าย ใช้งานสะดวกสำหรับเกษตรกรไทย
---
🔹 ส่วนหัว (Header)
- โลโก้ "ใจเกษตร" ซ้ายบน
- ปุ่ม “แจ้งเตือน” และ “โปรไฟล์ผู้ใช้” ขวาบน
- เมนูด้านล่าง (Sticky Bottom Navigation) ตลอดทุกหน้า
---
🔹 แท็บที่ 1: 📊 “วิเคราะห์ผลผลิตต่อไร่”
- ชนิดพืช: ข้าวโพดหวาน 🌽
- พื้นที่: 5 ไร่
- ผลผลิตเฉลี่ยปีที่แล้ว: 3.2 ตัน
- คาดการณ์ปีนี้ (หลังใช้ใจเกษตร): 4.6 ตัน
- กราฟแท่ง: เปรียบเทียบผลผลิตปี 1–3 (ก่อน/หลังใช้)
- ปุ่ม “คำนวณผลผลิตใหม่” (ใส่ข้อมูลแปลงใหม่)
---
🔹 แท็บที่ 2: 💰 “วิเคราะห์การประหยัดต้นทุน”
- เปรียบเทียบ:
- ปุ๋ยเคมีเดิม: 2,500 บาท/ไร่
- ใจเกษตร: 790 บาท/ไร่
- ประหยัดได้: 1,710 บาท/ไร่
- สรุปการประหยัดรวม: 8,550 บาท (สำหรับ 5 ไร่)
- กราฟวงกลม: “ต้นทุนเดิม” vs “ต้นทุนใหม่”
- ROI: คืนทุนภายใน 1 ฤดูกาล
---
🔹 แท็บที่ 3: 📈 “ราคาตลาดพืชสด (เรียลไทม์)”
- แสดงพืชยอดนิยม:
- ข้าวหอมมะลิ: 14,500 บ./ตัน ↑
- มะม่วงน้ำดอกไม้: 35 บ./กก. ↓
- ข้าวโพดหวาน: 6.5 บ./กก. (ทรงตัว)
- กราฟเส้น 30 วันย้อนหลัง: ราคาผลผลิต
- แหล่งอ้างอิง: ตลาดกลาง / DOA API
- ปุ่ม "ดูราคาทั้งประเทศ"
---
🔹 แท็บที่ 4: 🗓️ “แผนรอบการปลูกพืช”
- เลือกพืช: 🌾 ข้าว
- วางแผนจาก: วันที่ 1 พ.ย.
- ระบบแสดง:
- เตรียมดิน: 1–5 พ.ย.
- ปลูก: 6–10 พ.ย.
- ดูแล: 11 พ.ย.–15 ธ.ค.
- เก็บเกี่ยว: 20 ม.ค.
- แถบเวลาแบบ Gantt Chart Mockup
---
🔹 แท็บที่ 5: 🌱 “Crop Cycle รายพืช”
- แสดงวงจรข้าวโพด:
- 🚜 เตรียมดิน
- 🌱 หยอดเมล็ด
- 🌞 ให้น้ำ+แสง
- 🧪 ฉีดใจเกษตร (ช่วง 1, 2, 3)
- 🧺 เก็บเกี่ยว
- แสดงภาพประกอบ + ตารางการใช้ “ใจเกษตร”
- ปุ่ม: ดาวน์โหลดเป็น PDF
---
🔹 แท็บที่ 6: 🛍️ “ตลาดเกษตรกร”
- โหมด “ฝากขายผลผลิต”:
- ผลผลิต: มะละกอ
- ปริมาณ: 600 กก.
- ราคาขายที่เสนอ: 18 บ./กก.
- สถานะ: “รอจับคู่ผู้ซื้อ”
- โหมด “รวมสินค้าชุมชน”:
- ข้าวอินทรีย์บ้านท่าไม้
- ผักรวมปลอดสาร GAP
- ปุ่ม “สนใจรับซื้อ” / “แชทเกษตรกร”
---
🔹 แท็บที่ 7: 🤝 “สมัครเป็น BioAgri Coach”
- ข้อเสนอ:
- รับส่วนลดใจเกษตร
- รายได้จากแนะนำฟาร์มอื่น
- รับสิทธิอบรมฟรี + Dashboard ติดตามพื้นที่
- ปุ่มสมัคร: “เริ่มต้นเป็นนักดูแลดิน”
- Mock ข้อมูล: “คุณดูแลพื้นที่แล้ว 15 ไร่ | รายได้รวม 12,800 บาท”
---
🔹 แท็บที่ 8: 👤 โปรไฟล์ผู้ใช้งาน
- ชื่อ: สมชาย ใจดี
- แปลงที่ดูแล: 5 แปลง
- พืชหลัก: ข้าวโพด, ทุเรียน, มะเขือเทศ
- ใจเกษตรใช้แล้ว: 85 ลิตร
- คะแนนสะสม: 1,750 แต้ม
---
🔹 Bottom Navigation (5 เมนู)
- 🏠 หน้าแรก
- 📈 ผลผลิต & ต้นทุน
- 🛒 ตลาด
- 📅 แผนปลูก
- 👤 โปรไฟล์
---
**คำสั่งเพิ่มเติม:**
- ใช้ HTML5 + inline CSS3 เท่านั้น (ไม่มีไฟล์แยก)
- Responsive 100% สำหรับมือถือ
- Mock ข้อมูลจริงทุกจุด
- ใช้ฟอนต์ Prompt
- UI ดูสะอาด ทันสมัย ใช้งานง่าย
- README.md +7 -4
- index.html +531 -19
- script.js +436 -0
- style.css +166 -18
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title: Smart Farm
|
| 3 |
-
emoji: 🐠
|
| 4 |
colorFrom: red
|
| 5 |
-
colorTo:
|
|
|
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: ใจเกษตร Smart Farm 🌱
|
|
|
|
| 3 |
colorFrom: red
|
| 4 |
+
colorTo: pink
|
| 5 |
+
emoji: 🐳
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite-v3
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Welcome to your new DeepSite project!
|
| 13 |
+
This project was created with [DeepSite](https://huggingface.co/deepsite).
|
|
@@ -1,19 +1,531 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="th">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>ใจเกษตร Smart Farm - แพลตฟอร์มเกษตรอัจฉริยะ</title>
|
| 7 |
+
<link rel="icon" type="image/x-icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='50%' x='50%' font-size='50' text-anchor='middle'>🌱</text></svg>">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 10 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 11 |
+
<link href="https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
| 12 |
+
<link rel="stylesheet" href="style.css">
|
| 13 |
+
</head>
|
| 14 |
+
<body class="bg-gray-50 font-[Prompt]">
|
| 15 |
+
<!-- Header -->
|
| 16 |
+
<header class="bg-green-600 text-white p-4 sticky top-0 z-40 shadow-lg">
|
| 17 |
+
<div class="flex justify-between items-center">
|
| 18 |
+
<div class="flex items-center space-x-2">
|
| 19 |
+
<div class="w-10 h-10 bg-white rounded-full flex items-center justify-center">
|
| 20 |
+
<span class="text-green-600 text-xl">🌱</span>
|
| 21 |
+
</div>
|
| 22 |
+
<h1 class="text-xl font-bold">ใจเกษตร</h1>
|
| 23 |
+
</div>
|
| 24 |
+
<div class="flex items-center space-x-4">
|
| 25 |
+
<button class="relative" onclick="showNotifications()">
|
| 26 |
+
<i data-feather="bell" class="w-6 h-6"></i>
|
| 27 |
+
<span class="absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center">3</span>
|
| 28 |
+
</button>
|
| 29 |
+
<button onclick="showProfile()">
|
| 30 |
+
<div class="w-8 h-8 bg-green-500 rounded-full flex items-center justify-center">
|
| 31 |
+
<i data-feather="user" class="w-5 h-5"></i>
|
| 32 |
+
</div>
|
| 33 |
+
</button>
|
| 34 |
+
</div>
|
| 35 |
+
</div>
|
| 36 |
+
</header>
|
| 37 |
+
|
| 38 |
+
<!-- Main Content -->
|
| 39 |
+
<main class="pb-20 min-h-screen">
|
| 40 |
+
<!-- Tab 1: วิเคราะห์ผลผลิตต่อไร่ -->
|
| 41 |
+
<div id="tab1" class="tab-content p-4">
|
| 42 |
+
<h2 class="text-2xl font-bold text-green-800 mb-4">📊 วิเคราะห์ผลผลิตต่อไร่</h2>
|
| 43 |
+
|
| 44 |
+
<div class="bg-white rounded-lg shadow-md p-4 mb-4">
|
| 45 |
+
<h3 class="font-semibold text-lg mb-3">ข้อมูลพืชปัจจุบัน</h3>
|
| 46 |
+
<div class="space-y-2">
|
| 47 |
+
<div class="flex justify-between">
|
| 48 |
+
<span class="text-gray-600">ชนิดพืช:</span>
|
| 49 |
+
<span class="font-medium">🌽 ข้าวโพดหวาน</span>
|
| 50 |
+
</div>
|
| 51 |
+
<div class="flex justify-between">
|
| 52 |
+
<span class="text-gray-600">พื้นที่:</span>
|
| 53 |
+
<span class="font-medium">5 ไร่</span>
|
| 54 |
+
</div>
|
| 55 |
+
<div class="flex justify-between">
|
| 56 |
+
<span class="text-gray-600">ผลผลิตเฉลี่ยปีที่แล้ว:</span>
|
| 57 |
+
<span class="font-medium">3.2 ตัน</span>
|
| 58 |
+
</div>
|
| 59 |
+
<div class="flex justify-between">
|
| 60 |
+
<span class="text-gray-600">คาดการณ์ปีนี้:</span>
|
| 61 |
+
<span class="font-medium text-green-600">4.6 ตัน ↑43%</span>
|
| 62 |
+
</div>
|
| 63 |
+
</div>
|
| 64 |
+
</div>
|
| 65 |
+
|
| 66 |
+
<div class="bg-white rounded-lg shadow-md p-4 mb-4">
|
| 67 |
+
<h3 class="font-semibold text-lg mb-3">กราฟเปรียบเทียบผลผลิต (ตัน/ไร่)</h3>
|
| 68 |
+
<canvas id="yieldChart" width="400" height="200"></canvas>
|
| 69 |
+
</div>
|
| 70 |
+
|
| 71 |
+
<button onclick="calculateYield()" class="w-full bg-green-600 text-white py-3 rounded-lg font-medium hover:bg-green-700 transition">
|
| 72 |
+
คำนวณผลผลิตใหม่
|
| 73 |
+
</button>
|
| 74 |
+
</div>
|
| 75 |
+
|
| 76 |
+
<!-- Tab 2: วิเคราะห์การประหยัดต้นทุน -->
|
| 77 |
+
<div id="tab2" class="tab-content hidden p-4">
|
| 78 |
+
<h2 class="text-2xl font-bold text-green-800 mb-4">💰 วิเคราะห์การประหยัดต้นทุน</h2>
|
| 79 |
+
|
| 80 |
+
<div class="bg-white rounded-lg shadow-md p-4 mb-4">
|
| 81 |
+
<h3 class="font-semibold text-lg mb-3">เปรียบเทียบต้นทุนต่อไร่</h3>
|
| 82 |
+
<div class="space-y-3">
|
| 83 |
+
<div class="flex justify-between items-center p-3 bg-red-50 rounded">
|
| 84 |
+
<span class="text-gray-700">ปุ๋ยเคมีเดิม:</span>
|
| 85 |
+
<span class="font-bold text-red-600">2,500 บาท/ไร่</span>
|
| 86 |
+
</div>
|
| 87 |
+
<div class="flex justify-between items-center p-3 bg-green-50 rounded">
|
| 88 |
+
<span class="text-gray-700">ใจเกษตร:</span>
|
| 89 |
+
<span class="font-bold text-green-600">790 บาท/ไร่</span>
|
| 90 |
+
</div>
|
| 91 |
+
<div class="flex justify-between items-center p-3 bg-blue-50 rounded border-2 border-blue-200">
|
| 92 |
+
<span class="text-gray-700 font-semibold">ประหยัดได้:</span>
|
| 93 |
+
<span class="font-bold text-blue-600">1,710 บาท/ไร่</span>
|
| 94 |
+
</div>
|
| 95 |
+
</div>
|
| 96 |
+
</div>
|
| 97 |
+
|
| 98 |
+
<div class="bg-white rounded-lg shadow-md p-4 mb-4">
|
| 99 |
+
<h3 class="font-semibold text-lg mb-3">สรุปการประหยัดรวม (5 ไร่)</h3>
|
| 100 |
+
<div class="text-center">
|
| 101 |
+
<div class="text-3xl font-bold text-green-600">8,550 บาท</div>
|
| 102 |
+
<div class="text-gray-600 mt-2">ROI: คืนทุนภายใน 1 ฤดูกาล</div>
|
| 103 |
+
</div>
|
| 104 |
+
<canvas id="costChart" width="400" height="200" class="mt-4"></canvas>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
|
| 108 |
+
<!-- Tab 3: ราคาตลาดพืชสด -->
|
| 109 |
+
<div id="tab3" class="tab-content hidden p-4">
|
| 110 |
+
<h2 class="text-2xl font-bold text-green-800 mb-4">📈 ราคาตลาดพืชสด (เรียลไทม์)</h2>
|
| 111 |
+
|
| 112 |
+
<div class="bg-white rounded-lg shadow-md p-4 mb-4">
|
| 113 |
+
<h3 class="font-semibold text-lg mb-3">ราคาพืชยอดนิยมวันนี้</h3>
|
| 114 |
+
<div class="space-y-3">
|
| 115 |
+
<div class="flex justify-between items-center p-3 border rounded">
|
| 116 |
+
<div>
|
| 117 |
+
<span class="font-medium">ข้าวหอมมะลิ</span>
|
| 118 |
+
<span class="text-xs text-gray-500 block">ตลาดกลาง</span>
|
| 119 |
+
</div>
|
| 120 |
+
<div class="text-right">
|
| 121 |
+
<div class="font-bold">14,500 บ./ตัน</div>
|
| 122 |
+
<span class="text-green-600 text-sm">↑ 2.3%</span>
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
<div class="flex justify-between items-center p-3 border rounded">
|
| 126 |
+
<div>
|
| 127 |
+
<span class="font-medium">มะม่วงน้ำดอกไม้</span>
|
| 128 |
+
<span class="text-xs text-gray-500 block">ตลาดสด</span>
|
| 129 |
+
</div>
|
| 130 |
+
<div class="text-right">
|
| 131 |
+
<div class="font-bold">35 บ./กก.</div>
|
| 132 |
+
<span class="text-red-600 text-sm">↓ 1.2%</span>
|
| 133 |
+
</div>
|
| 134 |
+
</div>
|
| 135 |
+
<div class="flex justify-between items-center p-3 border rounded">
|
| 136 |
+
<div>
|
| 137 |
+
<span class="font-medium">ข้าวโพดหวาน</span>
|
| 138 |
+
<span class="text-xs text-gray-500 block">ตลาดกลาง</span>
|
| 139 |
+
</div>
|
| 140 |
+
<div class="text-right">
|
| 141 |
+
<div class="font-bold">6.5 บ./กก.</div>
|
| 142 |
+
<span class="text-gray-600 text-sm">—</span>
|
| 143 |
+
</div>
|
| 144 |
+
</div>
|
| 145 |
+
</div>
|
| 146 |
+
</div>
|
| 147 |
+
|
| 148 |
+
<div class="bg-white rounded-lg shadow-md p-4 mb-4">
|
| 149 |
+
<h3 class="font-semibold text-lg mb-3">กราฟราคา 30 วันย้อนหลัง</h3>
|
| 150 |
+
<canvas id="priceChart" width="400" height="200"></canvas>
|
| 151 |
+
</div>
|
| 152 |
+
|
| 153 |
+
<button onclick="viewNationalPrices()" class="w-full bg-blue-600 text-white py-3 rounded-lg font-medium hover:bg-blue-700 transition">
|
| 154 |
+
ดูราคาทั้งประเทศ
|
| 155 |
+
</button>
|
| 156 |
+
</div>
|
| 157 |
+
|
| 158 |
+
<!-- Tab 4: แผนรอบการปลูกพืช -->
|
| 159 |
+
<div id="tab4" class="tab-content hidden p-4">
|
| 160 |
+
<h2 class="text-2xl font-bold text-green-800 mb-4">🗓️ ��ผนรอบการปลูกพืช</h2>
|
| 161 |
+
|
| 162 |
+
<div class="bg-white rounded-lg shadow-md p-4 mb-4">
|
| 163 |
+
<h3 class="font-semibold text-lg mb-3">เลือกพืชและวางแผน</h3>
|
| 164 |
+
<div class="space-y-3">
|
| 165 |
+
<select class="w-full p-3 border rounded-lg">
|
| 166 |
+
<option>🌾 ข้าว</option>
|
| 167 |
+
<option>🌽 ข้าวโพด</option>
|
| 168 |
+
<option>🍅 มะเขือเทศ</option>
|
| 169 |
+
<option>🥬 ผักใบเขียว</option>
|
| 170 |
+
</select>
|
| 171 |
+
<input type="date" value="2024-11-01" class="w-full p-3 border rounded-lg">
|
| 172 |
+
</div>
|
| 173 |
+
</div>
|
| 174 |
+
|
| 175 |
+
<div class="bg-white rounded-lg shadow-md p-4">
|
| 176 |
+
<h3 class="font-semibold text-lg mb-3">แผนการปลูก</h3>
|
| 177 |
+
<div class="space-y-3">
|
| 178 |
+
<div class="flex items-center space-x-3">
|
| 179 |
+
<div class="w-3 h-3 bg-green-500 rounded-full"></div>
|
| 180 |
+
<div class="flex-1">
|
| 181 |
+
<div class="font-medium">เตรียมดิน</div>
|
| 182 |
+
<div class="text-sm text-gray-600">1–5 พ.ย. 2024</div>
|
| 183 |
+
</div>
|
| 184 |
+
</div>
|
| 185 |
+
<div class="flex items-center space-x-3">
|
| 186 |
+
<div class="w-3 h-3 bg-blue-500 rounded-full"></div>
|
| 187 |
+
<div class="flex-1">
|
| 188 |
+
<div class="font-medium">ปลูก</div>
|
| 189 |
+
<div class="text-sm text-gray-600">6–10 พ.ย. 2024</div>
|
| 190 |
+
</div>
|
| 191 |
+
</div>
|
| 192 |
+
<div class="flex items-center space-x-3">
|
| 193 |
+
<div class="w-3 h-3 bg-yellow-500 rounded-full"></div>
|
| 194 |
+
<div class="flex-1">
|
| 195 |
+
<div class="font-medium">ดูแลรักษา</div>
|
| 196 |
+
<div class="text-sm text-gray-600">11 พ.ย.–15 ธ.ค. 2024</div>
|
| 197 |
+
</div>
|
| 198 |
+
</div>
|
| 199 |
+
<div class="flex items-center space-x-3">
|
| 200 |
+
<div class="w-3 h-3 bg-red-500 rounded-full"></div>
|
| 201 |
+
<div class="flex-1">
|
| 202 |
+
<div class="font-medium">เก็บเกี่ยว</div>
|
| 203 |
+
<div class="text-sm text-gray-600">20 ม.ค. 2025</div>
|
| 204 |
+
</div>
|
| 205 |
+
</div>
|
| 206 |
+
</div>
|
| 207 |
+
</div>
|
| 208 |
+
</div>
|
| 209 |
+
|
| 210 |
+
<!-- Tab 5: Crop Cycle -->
|
| 211 |
+
<div id="tab5" class="tab-content hidden p-4">
|
| 212 |
+
<h2 class="text-2xl font-bold text-green-800 mb-4">🌱 Crop Cycle รายพืช</h2>
|
| 213 |
+
|
| 214 |
+
<div class="bg-white rounded-lg shadow-md p-4 mb-4">
|
| 215 |
+
<h3 class="font-semibold text-lg mb-3">วงจรการเจริญเติบโตข้าวโพด</h3>
|
| 216 |
+
<div class="space-y-4">
|
| 217 |
+
<div class="flex items-center space-x-3">
|
| 218 |
+
<span class="text-2xl">🚜</span>
|
| 219 |
+
<div class="flex-1">
|
| 220 |
+
<div class="font-medium">เตรียมดิน</div>
|
| 221 |
+
<div class="text-sm text-gray-600">วันที่ 1-5</div>
|
| 222 |
+
</div>
|
| 223 |
+
</div>
|
| 224 |
+
<div class="flex items-center space-x-3">
|
| 225 |
+
<span class="text-2xl">🌱</span>
|
| 226 |
+
<div class="flex-1">
|
| 227 |
+
<div class="font-medium">หยอดเมล็ด</div>
|
| 228 |
+
<div class="text-sm text-gray-600">วันที่ 6-7</div>
|
| 229 |
+
</div>
|
| 230 |
+
</div>
|
| 231 |
+
<div class="flex items-center space-x-3">
|
| 232 |
+
<span class="text-2xl">🌞</span>
|
| 233 |
+
<div class="flex-1">
|
| 234 |
+
<div class="font-medium">ให้น้ำและแสง</div>
|
| 235 |
+
<div class="text-sm text-gray-600">วันที่ 8-30</div>
|
| 236 |
+
</div>
|
| 237 |
+
</div>
|
| 238 |
+
<div class="flex items-center space-x-3">
|
| 239 |
+
<span class="text-2xl">🧪</span>
|
| 240 |
+
<div class="flex-1">
|
| 241 |
+
<div class="font-medium">ฉีดใจเกษตร</div>
|
| 242 |
+
<div class="text-sm text-gray-600">ช่วงที่ 1, 2, 3</div>
|
| 243 |
+
<div class="text-xs text-green-600 mt-1">- ช่วงที่ 1: 10 ลิตร/ไร่</div>
|
| 244 |
+
<div class="text-xs text-green-600">- ช่วงที่ 2: 15 ลิตร/ไร่</div>
|
| 245 |
+
<div class="text-xs text-green-600">- ช่วงที่ 3: 20 ลิตร/ไร่</div>
|
| 246 |
+
</div>
|
| 247 |
+
</div>
|
| 248 |
+
<div class="flex items-center space-x-3">
|
| 249 |
+
<span class="text-2xl">🧺</span>
|
| 250 |
+
<div class="flex-1">
|
| 251 |
+
<div class="font-medium">เก็บเกี่ยว</div>
|
| 252 |
+
<div class="text-sm text-gray-600">วันที่ 90-95</div>
|
| 253 |
+
</div>
|
| 254 |
+
</div>
|
| 255 |
+
</div>
|
| 256 |
+
</div>
|
| 257 |
+
|
| 258 |
+
<div class="bg-white rounded-lg shadow-md p-4 mb-4">
|
| 259 |
+
<img src="http://static.photos/agriculture/640x360/123" alt="Crop Cycle" class="w-full rounded-lg mb-3">
|
| 260 |
+
<table class="w-full text-sm">
|
| 261 |
+
<thead>
|
| 262 |
+
<tr class="border-b">
|
| 263 |
+
<th class="text-left py-2">ระยะ</th>
|
| 264 |
+
<th class="text-center py-2">ใจเกษตร (ลิตร)</th>
|
| 265 |
+
<th class="text-center py-2">วันที่ฉีด</th>
|
| 266 |
+
</tr>
|
| 267 |
+
</thead>
|
| 268 |
+
<tbody>
|
| 269 |
+
<tr class="border-b">
|
| 270 |
+
<td class="py-2">ช่วงที่ 1</td>
|
| 271 |
+
<td class="text-center py-2">10</td>
|
| 272 |
+
<td class="text-center py-2">วันที่ 20</td>
|
| 273 |
+
</tr>
|
| 274 |
+
<tr class="border-b">
|
| 275 |
+
<td class="py-2">ช่วงที่ 2</td>
|
| 276 |
+
<td class="text-center py-2">15</td>
|
| 277 |
+
<td class="text-center py-2">วันที่ 45</td>
|
| 278 |
+
</tr>
|
| 279 |
+
<tr>
|
| 280 |
+
<td class="py-2">ช่วงที่ 3</td>
|
| 281 |
+
<td class="text-center py-2">20</td>
|
| 282 |
+
<td class="text-center py-2">วันที่ 70</td>
|
| 283 |
+
</tr>
|
| 284 |
+
</tbody>
|
| 285 |
+
</table>
|
| 286 |
+
</div>
|
| 287 |
+
|
| 288 |
+
<button onclick="downloadPDF()" class="w-full bg-green-600 text-white py-3 rounded-lg font-medium hover:bg-green-700 transition">
|
| 289 |
+
ดาวน์โหลดเป็น PDF
|
| 290 |
+
</button>
|
| 291 |
+
</div>
|
| 292 |
+
|
| 293 |
+
<!-- Tab 6: ตลาดเกษตรกร -->
|
| 294 |
+
<div id="tab6" class="tab-content hidden p-4">
|
| 295 |
+
<h2 class="text-2xl font-bold text-green-800 mb-4">🛍️ ตลาดเกษตรกร</h2>
|
| 296 |
+
|
| 297 |
+
<div class="bg-white rounded-lg shadow-md p-4 mb-4">
|
| 298 |
+
<h3 class="font-semibold text-lg mb-3">ฝากขายผลผลิต</h3>
|
| 299 |
+
<div class="space-y-3">
|
| 300 |
+
<div class="border rounded-lg p-3">
|
| 301 |
+
<div class="flex justify-between items-start mb-2">
|
| 302 |
+
<div>
|
| 303 |
+
<span class="font-medium">มะละกอ</span>
|
| 304 |
+
<span class="bg-yellow-100 text-yellow-800 text-xs px-2 py-1 rounded ml-2">รอจับคู่</span>
|
| 305 |
+
</div>
|
| 306 |
+
<span class="text-green-600 font-bold">18 บ./กก.</span>
|
| 307 |
+
</div>
|
| 308 |
+
<div class="text-sm text-gray-600">ปริมาณ: 600 กก. | วันที่: 15 พ.ย. 2024</div>
|
| 309 |
+
<div class="flex space-x-2 mt-2">
|
| 310 |
+
<button class="text-sm bg-blue-600 text-white px-3 py-1 rounded">แก้ไข</button>
|
| 311 |
+
<button class="text-sm bg-red-600 text-white px-3 py-1 rounded">ลบ</button>
|
| 312 |
+
</div>
|
| 313 |
+
</div>
|
| 314 |
+
</div>
|
| 315 |
+
<button onclick="addProduct()" class="w-full bg-green-600 text-white py-2 rounded-lg font-medium mt-3 hover:bg-green-700 transition">
|
| 316 |
+
+ เพิ่มผลผลิตใหม่
|
| 317 |
+
</button>
|
| 318 |
+
</div>
|
| 319 |
+
|
| 320 |
+
<div class="bg-white rounded-lg shadow-md p-4">
|
| 321 |
+
<h3 class="font-semibold text-lg mb-3">รวมสินค้าชุมชน</h3>
|
| 322 |
+
<div class="space-y-3">
|
| 323 |
+
<div class="border rounded-lg p-3">
|
| 324 |
+
<div class="flex justify-between items-center">
|
| 325 |
+
<div>
|
| 326 |
+
<span class="font-medium">ข้าวอินทรีย์บ้านท่าไม้</span>
|
| 327 |
+
<div class="text-sm text-gray-600">จ.นครสวรรค์ | มี 10 รายการ</div>
|
| 328 |
+
</div>
|
| 329 |
+
<button class="text-sm bg-blue-600 text-white px-3 py-1 rounded">สนใจ</button>
|
| 330 |
+
</div>
|
| 331 |
+
</div>
|
| 332 |
+
<div class="border rounded-lg p-3">
|
| 333 |
+
<div class="flex justify-between items-center">
|
| 334 |
+
<div>
|
| 335 |
+
<span class="font-medium">ผักรวมปลอดสาร GAP</span>
|
| 336 |
+
<div class="text-sm text-gray-600">จ.เชียงใหม่ | มี 25 รายการ</div>
|
| 337 |
+
</div>
|
| 338 |
+
<button class="text-sm bg-blue-600 text-white px-3 py-1 rounded">สนใจ</button>
|
| 339 |
+
</div>
|
| 340 |
+
</div>
|
| 341 |
+
</div>
|
| 342 |
+
</div>
|
| 343 |
+
</div>
|
| 344 |
+
|
| 345 |
+
<!-- Tab 7: สมัครเป็น BioAgri Coach -->
|
| 346 |
+
<div id="tab7" class="tab-content hidden p-4">
|
| 347 |
+
<h2 class="text-2xl font-bold text-green-800 mb-4">🤝 สมัครเป็น BioAgri Coach</h2>
|
| 348 |
+
|
| 349 |
+
<div class="bg-gradient-to-r from-green-500 to-green-600 text-white rounded-lg shadow-lg p-6 mb-4">
|
| 350 |
+
<h3 class="text-xl font-bold mb-3">เข้าร่วมเป็นนักดูแลดิน!</h3>
|
| 351 |
+
<div class="space-y-2 mb-4">
|
| 352 |
+
<div class="flex items-center space-x-2">
|
| 353 |
+
<i data-feather="check" class="w-5 h-5"></i>
|
| 354 |
+
<span>รับส่วนลดใจเกษตรพิเศษ</span>
|
| 355 |
+
</div>
|
| 356 |
+
<div class="flex items-center space-x-2">
|
| 357 |
+
<i data-feather="check" class="w-5 h-5"></i>
|
| 358 |
+
<span>รายได้จากการแนะนำฟาร์มอื่น</span>
|
| 359 |
+
</div>
|
| 360 |
+
<div class="flex items-center space-x-2">
|
| 361 |
+
<i data-feather="check" class="w-5 h-5"></i>
|
| 362 |
+
<span>อบรมฟรีพร้อม Certificate</span>
|
| 363 |
+
</div>
|
| 364 |
+
<div class="flex items-center space-x-2">
|
| 365 |
+
<i data-feather="check" class="w-5 h-5"></i>
|
| 366 |
+
<span>Dashboard ติดตามพื้นที่อัจฉริยะ</span>
|
| 367 |
+
</div>
|
| 368 |
+
</div>
|
| 369 |
+
<button onclick="becomeCoach()" class="w-full bg-white text-green-600 py-3 rounded-lg font-bold hover:bg-gray-100 transition">
|
| 370 |
+
เริ่มต้นเป็นนักดูแลดิน
|
| 371 |
+
</button>
|
| 372 |
+
</div>
|
| 373 |
+
|
| 374 |
+
<div class="bg-white rounded-lg shadow-md p-4 mb-4">
|
| 375 |
+
<h3 class="font-semibold text-lg mb-3">ผลงานของคุณ</h3>
|
| 376 |
+
<div class="grid grid-cols-2 gap-4">
|
| 377 |
+
<div class="text-center p-4 bg-green-50 rounded">
|
| 378 |
+
<div class="text-2xl font-bold text-green-600">15 ไร่</div>
|
| 379 |
+
<div class="text-sm text-gray-600">ดูแลพื้นที่แล้ว</div>
|
| 380 |
+
</div>
|
| 381 |
+
<div class="text-center p-4 bg-blue-50 rounded">
|
| 382 |
+
<div class="text-2xl font-bold text-blue-600">12,800 บ.</div>
|
| 383 |
+
<div class="text-sm text-gray-600">รายได้รวม</div>
|
| 384 |
+
</div>
|
| 385 |
+
</div>
|
| 386 |
+
</div>
|
| 387 |
+
|
| 388 |
+
<div class="bg-white rounded-lg shadow-md p-4">
|
| 389 |
+
<h3 class="font-semibold text-lg mb-3">ฟาร์มที่คุณดูแล</h3>
|
| 390 |
+
<div class="space-y-2">
|
| 391 |
+
<div class="flex justify-between items-center p-2 border rounded">
|
| 392 |
+
<span>ฟาร์มสุรชัย</span>
|
| 393 |
+
<span class="text-green-600 text-sm">ดูแล 5 ไร่</span>
|
| 394 |
+
</div>
|
| 395 |
+
<div class="flex justify-between items-center p-2 border rounded">
|
| 396 |
+
<span>ฟาร์มมาลี</span>
|
| 397 |
+
<span class="text-green-600 text-sm">ดูแล 3 ไร่</span>
|
| 398 |
+
</div>
|
| 399 |
+
</div>
|
| 400 |
+
</div>
|
| 401 |
+
</div>
|
| 402 |
+
|
| 403 |
+
<!-- Tab 8: โปรไฟล์ผู้ใช้งาน -->
|
| 404 |
+
<div id="tab8" class="tab-content hidden p-4">
|
| 405 |
+
<h2 class="text-2xl font-bold text-green-800 mb-4">👤 โปรไฟล์ผู้ใช้งาน</h2>
|
| 406 |
+
|
| 407 |
+
<div class="bg-white rounded-lg shadow-md p-4 mb-4">
|
| 408 |
+
<div class="flex items-center space-x-4 mb-4">
|
| 409 |
+
<div class="w-20 h-20 bg-green-500 rounded-full flex items-center justify-center">
|
| 410 |
+
<i data-feather="user" class="w-12 h-12 text-white"></i>
|
| 411 |
+
</div>
|
| 412 |
+
<div>
|
| 413 |
+
<h3 class="text-xl font-bold">สมชาย ใจดี</h3>
|
| 414 |
+
<p class="text-gray-600">เกษตรกรระดับทอง</p>
|
| 415 |
+
</div>
|
| 416 |
+
</div>
|
| 417 |
+
|
| 418 |
+
<div class="space-y-3">
|
| 419 |
+
<div class="flex justify-between items-center p-3 bg-gray-50 rounded">
|
| 420 |
+
<span class="text-gray-700">📊 แปลงที่ดูแล</span>
|
| 421 |
+
<span class="font-bold text-green-600">5 แปลง</span>
|
| 422 |
+
</div>
|
| 423 |
+
<div class="flex justify-between items-center p-3 bg-gray-50 rounded">
|
| 424 |
+
<span class="text-gray-700">🌾 พืชหลัก</span>
|
| 425 |
+
<span class="font-medium">ข้าวโพด, ทุเรียน, มะเขือเทศ</span>
|
| 426 |
+
</div>
|
| 427 |
+
<div class="flex justify-between items-center p-3 bg-gray-50 rounded">
|
| 428 |
+
<span class="text-gray-700">🧪 ใจเกษตรใช้แล้ว</span>
|
| 429 |
+
<span class="font-bold text-green-600">85 ลิตร</span>
|
| 430 |
+
</div>
|
| 431 |
+
<div class="flex justify-between items-center p-3 bg-gray-50 rounded">
|
| 432 |
+
<span class="text-gray-700">⭐ คะแนนสะสม</span>
|
| 433 |
+
<span class="font-bold text-yellow-600">1,750 แต้ม</span>
|
| 434 |
+
</div>
|
| 435 |
+
</div>
|
| 436 |
+
</div>
|
| 437 |
+
|
| 438 |
+
<div class="bg-white rounded-lg shadow-md p-4 mb-4">
|
| 439 |
+
<h3 class="font-semibold text-lg mb-3">ความสำเร็จ</h3>
|
| 440 |
+
<div class="flex space-x-4 overflow-x-auto">
|
| 441 |
+
<div class="flex-shrink-0 text-center">
|
| 442 |
+
<div class="text-3xl mb-1">🏆</div>
|
| 443 |
+
<div class="text-xs">เกษตรกรตัวอย่าง</div>
|
| 444 |
+
</div>
|
| 445 |
+
<div class="flex-shrink-0 text-center">
|
| 446 |
+
<div class="text-3xl mb-1">🌱</div>
|
| 447 |
+
<div class="text-xs">เกษตรอินทรีย์</div>
|
| 448 |
+
</div>
|
| 449 |
+
<div class="flex-shrink-0 text-center">
|
| 450 |
+
<div class="text-3xl mb-1">💚</div>
|
| 451 |
+
<div class="text-xs">พลังงานสะอาด</div>
|
| 452 |
+
</div>
|
| 453 |
+
<div class="flex-shrink-0 text-center">
|
| 454 |
+
<div class="text-3xl mb-1">📈</div>
|
| 455 |
+
<div class="text-xs">ผลผลิตเกินเป้า</div>
|
| 456 |
+
</div>
|
| 457 |
+
</div>
|
| 458 |
+
</div>
|
| 459 |
+
|
| 460 |
+
<div class="space-y-2">
|
| 461 |
+
<button class="w-full bg-gray-100 text-gray-700 py-2 rounded-lg font-medium hover:bg-gray-200 transition">
|
| 462 |
+
แก้ไขข้อมูลส่วนตัว
|
| 463 |
+
</button>
|
| 464 |
+
<button class="w-full bg-gray-100 text-gray-700 py-2 rounded-lg font-medium hover:bg-gray-200 transition">
|
| 465 |
+
ประวัติการซื้อ
|
| 466 |
+
</button>
|
| 467 |
+
<button class="w-full bg-gray-100 text-gray-700 py-2 rounded-lg font-medium hover:bg-gray-200 transition">
|
| 468 |
+
ติดต่อฝ่ายสนับสนุน
|
| 469 |
+
</button>
|
| 470 |
+
<button class="w-full bg-red-600 text-white py-2 rounded-lg font-medium hover:bg-red-700 transition">
|
| 471 |
+
ออกจากระบบ
|
| 472 |
+
</button>
|
| 473 |
+
</div>
|
| 474 |
+
</div>
|
| 475 |
+
</main>
|
| 476 |
+
|
| 477 |
+
<!-- Bottom Navigation -->
|
| 478 |
+
<nav class="fixed bottom-0 left-0 right-0 bg-white border-t shadow-lg z-40">
|
| 479 |
+
<div class="flex justify-around items-center py-2">
|
| 480 |
+
<button onclick="switchTab(1)" class="nav-btn flex flex-col items-center p-2 text-green-600" data-tab="1">
|
| 481 |
+
<i data-feather="home" class="w-6 h-6"></i>
|
| 482 |
+
<span class="text-xs mt-1">หน้าแรก</span>
|
| 483 |
+
</button>
|
| 484 |
+
<button onclick="switchTab(2)" class="nav-btn flex flex-col items-center p-2 text-gray-600" data-tab="2">
|
| 485 |
+
<i data-feather="trending-up" class="w-6 h-6"></i>
|
| 486 |
+
<span class="text-xs mt-1">ผลผลิต</span>
|
| 487 |
+
</button>
|
| 488 |
+
<button onclick="switchTab(6)" class="nav-btn flex flex-col items-center p-2 text-gray-600" data-tab="6">
|
| 489 |
+
<i data-feather="shopping-cart" class="w-6 h-6"></i>
|
| 490 |
+
<span class="text-xs mt-1">ตลาด</span>
|
| 491 |
+
</button>
|
| 492 |
+
<button onclick="switchTab(4)" class="nav-btn flex flex-col items-center p-2 text-gray-600" data-tab="4">
|
| 493 |
+
<i data-feather="calendar" class="w-6 h-6"></i>
|
| 494 |
+
<span class="text-xs mt-1">แผนปลูก</span>
|
| 495 |
+
</button>
|
| 496 |
+
<button onclick="switchTab(8)" class="nav-btn flex flex-col items-center p-2 text-gray-600" data-tab="8">
|
| 497 |
+
<i data-feather="user" class="w-6 h-6"></i>
|
| 498 |
+
<span class="text-xs mt-1">โปรไฟล์</span>
|
| 499 |
+
</button>
|
| 500 |
+
</div>
|
| 501 |
+
</nav>
|
| 502 |
+
|
| 503 |
+
<!-- Notification Modal -->
|
| 504 |
+
<div id="notificationModal" class="fixed inset-0 bg-black bg-opacity-50 z-50 hidden flex items-center justify-center">
|
| 505 |
+
<div class="bg-white rounded-lg p-6 m-4 max-w-sm w-full">
|
| 506 |
+
<h3 class="text-lg font-bold mb-3">การแจ้งเตือน</h3>
|
| 507 |
+
<div class="space-y-2">
|
| 508 |
+
<div class="p-3 bg-blue-50 rounded">
|
| 509 |
+
<div class="font-medium">📈 ราคาข้าวโพดขึ้น 2.3%</div>
|
| 510 |
+
<div class="text-sm text-gray-600">2 ชั่วโมงที่แล้ว</div>
|
| 511 |
+
</div>
|
| 512 |
+
<div class="p-3 bg-green-50 rounded">
|
| 513 |
+
<div class="font-medium">🌱 ถึงเวลาฉีดใจเกษตรช่วงที่ 2</div>
|
| 514 |
+
<div class="text-sm text-gray-600">วันนี้ 10:00</div>
|
| 515 |
+
</div>
|
| 516 |
+
<div class="p-3 bg-yellow-50 rounded">
|
| 517 |
+
<div class="font-medium">🌧️ พยากรณ์ฝนตกใน 3 วันข้างหน้า</div>
|
| 518 |
+
<div class="text-sm text-gray-600">เมื่อวานนี้</div>
|
| 519 |
+
</div>
|
| 520 |
+
</div>
|
| 521 |
+
<button onclick="closeNotifications()" class="w-full mt-4 bg-green-600 text-white py-2 rounded-lg">
|
| 522 |
+
ปิด
|
| 523 |
+
</button>
|
| 524 |
+
</div>
|
| 525 |
+
</div>
|
| 526 |
+
|
| 527 |
+
<script src="script.js"></script>
|
| 528 |
+
<script>feather.replace();</script>
|
| 529 |
+
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 530 |
+
</body>
|
| 531 |
+
</html>
|
|
@@ -0,0 +1,436 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Global variables
|
| 2 |
+
let currentTab = 1;
|
| 3 |
+
const charts = {};
|
| 4 |
+
|
| 5 |
+
// Initialize the app
|
| 6 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 7 |
+
initializeCharts();
|
| 8 |
+
feather.replace();
|
| 9 |
+
showTab(currentTab);
|
| 10 |
+
});
|
| 11 |
+
|
| 12 |
+
// Tab switching functionality
|
| 13 |
+
function switchTab(tabNumber) {
|
| 14 |
+
currentTab = tabNumber;
|
| 15 |
+
showTab(tabNumber);
|
| 16 |
+
updateNavigation(tabNumber);
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
function showTab(tabNumber) {
|
| 20 |
+
// Hide all tabs
|
| 21 |
+
const allTabs = document.querySelectorAll('.tab-content');
|
| 22 |
+
allTabs.forEach(tab => tab.classList.add('hidden'));
|
| 23 |
+
|
| 24 |
+
// Show selected tab
|
| 25 |
+
const selectedTab = document.getElementById(`tab${tabNumber}`);
|
| 26 |
+
if (selectedTab) {
|
| 27 |
+
selectedTab.classList.remove('hidden');
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
function updateNavigation(activeTab) {
|
| 32 |
+
const navButtons = document.querySelectorAll('.nav-btn');
|
| 33 |
+
navButtons.forEach(btn => {
|
| 34 |
+
if (parseInt(btn.dataset.tab) === activeTab) {
|
| 35 |
+
btn.classList.add('text-green-600');
|
| 36 |
+
btn.classList.remove('text-gray-600');
|
| 37 |
+
} else {
|
| 38 |
+
btn.classList.remove('text-green-600');
|
| 39 |
+
btn.classList.add('text-gray-600');
|
| 40 |
+
}
|
| 41 |
+
});
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
// Initialize charts
|
| 45 |
+
function initializeCharts() {
|
| 46 |
+
// Yield Chart (Bar Chart)
|
| 47 |
+
const yieldCanvas = document.getElementById('yieldChart');
|
| 48 |
+
if (yieldCanvas) {
|
| 49 |
+
const ctx = yieldCanvas.getContext('2d');
|
| 50 |
+
drawBarChart(ctx, yieldCanvas, {
|
| 51 |
+
labels: ['ปีที่ 1', 'ปีที่ 2', 'ปีที่ 3'],
|
| 52 |
+
datasets: [
|
| 53 |
+
{
|
| 54 |
+
label: 'ก่อนใช้ใจเกษตร',
|
| 55 |
+
data: [3.2, 3.3, 3.1],
|
| 56 |
+
color: '#ef4444'
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
label: 'หลังใช้ใจเกษตร',
|
| 60 |
+
data: [4.2, 4.5, 4.6],
|
| 61 |
+
color: '#22c55e'
|
| 62 |
+
}
|
| 63 |
+
]
|
| 64 |
+
});
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
// Cost Chart (Pie Chart)
|
| 68 |
+
const costCanvas = document.getElementById('costChart');
|
| 69 |
+
if (costCanvas) {
|
| 70 |
+
const ctx = costCanvas.getContext('2d');
|
| 71 |
+
drawPieChart(ctx, costCanvas, {
|
| 72 |
+
labels: ['ปุ๋ยเคมีเดิม', 'ใจเกษตร', 'อื่นๆ'],
|
| 73 |
+
data: [60, 25, 15],
|
| 74 |
+
colors: ['#ef4444', '#22c55e', '#e5e7eb']
|
| 75 |
+
});
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
// Price Chart (Line Chart)
|
| 79 |
+
const priceCanvas = document.getElementById('priceChart');
|
| 80 |
+
if (priceCanvas) {
|
| 81 |
+
const ctx = priceCanvas.getContext('2d');
|
| 82 |
+
drawLineChart(ctx, priceCanvas, {
|
| 83 |
+
labels: Array.from({length: 30}, (_, i) => `วันที่ ${i+1}`),
|
| 84 |
+
data: [14.2, 14.3, 14.5, 14.4, 14.6, 14.5, 14.7, 14.8, 14.9, 14.8,
|
| 85 |
+
14.9, 15.0, 15.1, 15.0, 14.9, 14.8, 14.7, 14.9, 15.0, 15.1,
|
| 86 |
+
15.2, 15.3, 15.2, 15.1, 15.0, 14.9, 15.0, 15.1, 15.2, 15.0],
|
| 87 |
+
color: '#16a34a'
|
| 88 |
+
});
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
// Simple bar chart drawing
|
| 93 |
+
function drawBarChart(ctx, canvas, data) {
|
| 94 |
+
const width = canvas.width;
|
| 95 |
+
const height = canvas.height;
|
| 96 |
+
const padding = 40;
|
| 97 |
+
const barWidth = (width - padding * 2) / (data.labels.length * 3);
|
| 98 |
+
const maxValue = 5;
|
| 99 |
+
|
| 100 |
+
ctx.clearRect(0, 0, width, height);
|
| 101 |
+
|
| 102 |
+
// Draw axes
|
| 103 |
+
ctx.strokeStyle = '#e5e7eb';
|
| 104 |
+
ctx.beginPath();
|
| 105 |
+
ctx.moveTo(padding, padding);
|
| 106 |
+
ctx.lineTo(padding, height - padding);
|
| 107 |
+
ctx.lineTo(width - padding, height - padding);
|
| 108 |
+
ctx.stroke();
|
| 109 |
+
|
| 110 |
+
// Draw bars
|
| 111 |
+
data.labels.forEach((label, i) => {
|
| 112 |
+
const x = padding + i * barWidth * 3 + barWidth / 2;
|
| 113 |
+
|
| 114 |
+
// Draw bars for each dataset
|
| 115 |
+
data.datasets.forEach((dataset, j) => {
|
| 116 |
+
const value = dataset.data[i];
|
| 117 |
+
const barHeight = (value / maxValue) * (height - padding * 2);
|
| 118 |
+
const barX = x + j * barWidth;
|
| 119 |
+
const barY = height - padding - barHeight;
|
| 120 |
+
|
| 121 |
+
ctx.fillStyle = dataset.color;
|
| 122 |
+
ctx.fillRect(barX, barY, barWidth - 5, barHeight);
|
| 123 |
+
});
|
| 124 |
+
|
| 125 |
+
// Draw labels
|
| 126 |
+
ctx.fillStyle = '#374151';
|
| 127 |
+
ctx.font = '12px Prompt';
|
| 128 |
+
ctx.textAlign = 'center';
|
| 129 |
+
ctx.fillText(label, x + barWidth, height - padding + 20);
|
| 130 |
+
});
|
| 131 |
+
|
| 132 |
+
// Draw legend
|
| 133 |
+
ctx.font = '12px Prompt';
|
| 134 |
+
let legendY = 20;
|
| 135 |
+
data.datasets.forEach((dataset) => {
|
| 136 |
+
ctx.fillStyle = dataset.color;
|
| 137 |
+
ctx.fillRect(width - 150, legendY - 10, 15, 15);
|
| 138 |
+
ctx.fillStyle = '#374151';
|
| 139 |
+
ctx.textAlign = 'left';
|
| 140 |
+
ctx.fillText(dataset.label, width - 130, legendY);
|
| 141 |
+
legendY += 25;
|
| 142 |
+
});
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
// Simple pie chart drawing
|
| 146 |
+
function drawPieChart(ctx, canvas, data) {
|
| 147 |
+
const width = canvas.width;
|
| 148 |
+
const height = canvas.height;
|
| 149 |
+
const centerX = width / 2;
|
| 150 |
+
const centerY = height / 2;
|
| 151 |
+
const radius = Math.min(width, height) / 2 - 40;
|
| 152 |
+
const total = data.data.reduce((a, b) => a + b, 0);
|
| 153 |
+
let currentAngle = -Math.PI / 2;
|
| 154 |
+
|
| 155 |
+
ctx.clearRect(0, 0, width, height);
|
| 156 |
+
|
| 157 |
+
// Draw pie slices
|
| 158 |
+
data.data.forEach((value, i) => {
|
| 159 |
+
const sliceAngle = (value / total) * 2 * Math.PI;
|
| 160 |
+
|
| 161 |
+
ctx.beginPath();
|
| 162 |
+
ctx.arc(centerX, centerY, radius, currentAngle, currentAngle + sliceAngle);
|
| 163 |
+
ctx.lineTo(centerX, centerY);
|
| 164 |
+
ctx.fillStyle = data.colors[i];
|
| 165 |
+
ctx.fill();
|
| 166 |
+
|
| 167 |
+
// Draw percentage
|
| 168 |
+
const percentage = ((value / total) * 100).toFixed(1) + '%';
|
| 169 |
+
const textAngle = currentAngle + sliceAngle / 2;
|
| 170 |
+
const textX = centerX + Math.cos(textAngle) * (radius / 2);
|
| 171 |
+
const textY = centerY + Math.sin(textAngle) * (radius / 2);
|
| 172 |
+
|
| 173 |
+
ctx.fillStyle = 'white';
|
| 174 |
+
ctx.font = 'bold 14px Prompt';
|
| 175 |
+
ctx.textAlign = 'center';
|
| 176 |
+
ctx.textBaseline = 'middle';
|
| 177 |
+
ctx.fillText(percentage, textX, textY);
|
| 178 |
+
|
| 179 |
+
currentAngle += sliceAngle;
|
| 180 |
+
});
|
| 181 |
+
|
| 182 |
+
// Draw legend
|
| 183 |
+
ctx.font = '12px Prompt';
|
| 184 |
+
let legendY = 20;
|
| 185 |
+
data.labels.forEach((label, i) => {
|
| 186 |
+
ctx.fillStyle = data.colors[i];
|
| 187 |
+
ctx.fillRect(10, legendY - 10, 15, 15);
|
| 188 |
+
ctx.fillStyle = '#374151';
|
| 189 |
+
ctx.textAlign = 'left';
|
| 190 |
+
ctx.fillText(`${label}: ${data.data[i]}%`, 30, legendY);
|
| 191 |
+
legendY += 25;
|
| 192 |
+
});
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
// Simple line chart drawing
|
| 196 |
+
function drawLineChart(ctx, canvas, data) {
|
| 197 |
+
const width = canvas.width;
|
| 198 |
+
const height = canvas.height;
|
| 199 |
+
const padding = 40;
|
| 200 |
+
const pointSpacing = (width - padding * 2) / (data.labels.length - 1);
|
| 201 |
+
const maxValue = Math.max(...data.data);
|
| 202 |
+
const minValue = Math.min(...data.data);
|
| 203 |
+
const valueRange = maxValue - minValue;
|
| 204 |
+
|
| 205 |
+
ctx.clearRect(0, 0, width, height);
|
| 206 |
+
|
| 207 |
+
// Draw axes
|
| 208 |
+
ctx.strokeStyle = '#e5e7eb';
|
| 209 |
+
ctx.beginPath();
|
| 210 |
+
ctx.moveTo(padding, padding);
|
| 211 |
+
ctx.lineTo(padding, height - padding);
|
| 212 |
+
ctx.lineTo(width - padding, height - padding);
|
| 213 |
+
ctx.stroke();
|
| 214 |
+
|
| 215 |
+
// Draw line
|
| 216 |
+
ctx.strokeStyle = data.color;
|
| 217 |
+
ctx.lineWidth = 2;
|
| 218 |
+
ctx.beginPath();
|
| 219 |
+
|
| 220 |
+
data.data.forEach((value, i) => {
|
| 221 |
+
const x = padding + i * pointSpacing;
|
| 222 |
+
const y = height - padding - ((value - minValue) / valueRange) * (height - padding * 2);
|
| 223 |
+
|
| 224 |
+
if (i === 0) {
|
| 225 |
+
ctx.moveTo(x, y);
|
| 226 |
+
} else {
|
| 227 |
+
ctx.lineTo(x, y);
|
| 228 |
+
}
|
| 229 |
+
});
|
| 230 |
+
|
| 231 |
+
ctx.stroke();
|
| 232 |
+
|
| 233 |
+
// Draw points
|
| 234 |
+
data.data.forEach((value, i) => {
|
| 235 |
+
const x = padding + i * pointSpacing;
|
| 236 |
+
const y = height - padding - ((value - minValue) / valueRange) * (height - padding * 2);
|
| 237 |
+
|
| 238 |
+
ctx.beginPath();
|
| 239 |
+
ctx.arc(x, y, 3, 0, Math.PI * 2);
|
| 240 |
+
ctx.fillStyle = data.color;
|
| 241 |
+
ctx.fill();
|
| 242 |
+
});
|
| 243 |
+
|
| 244 |
+
// Draw Y-axis labels
|
| 245 |
+
ctx.fillStyle = '#6b7280';
|
| 246 |
+
ctx.font = '10px Prompt';
|
| 247 |
+
ctx.textAlign = 'right';
|
| 248 |
+
for (let i = 0; i <= 5; i++) {
|
| 249 |
+
const value = minValue + (valueRange * i / 5);
|
| 250 |
+
const y = height - padding - (i / 5) * (height - padding * 2);
|
| 251 |
+
ctx.fillText(value.toFixed(1) + 'k', padding - 10, y + 3);
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
// Draw X-axis label
|
| 255 |
+
ctx.fillStyle = '#6b7280';
|
| 256 |
+
ctx.font = '10px Prompt';
|
| 257 |
+
ctx.textAlign = 'center';
|
| 258 |
+
ctx.fillText('30 วันย้อนหลัง', width / 2, height - 10);
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
// Modal functions
|
| 262 |
+
function showNotifications() {
|
| 263 |
+
const modal = document.getElementById('notificationModal');
|
| 264 |
+
modal.classList.remove('hidden');
|
| 265 |
+
modal.classList.add('flex');
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
function closeNotifications() {
|
| 269 |
+
const modal = document.getElementById('notificationModal');
|
| 270 |
+
modal.classList.add('hidden');
|
| 271 |
+
modal.classList.remove('flex');
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
function showProfile() {
|
| 275 |
+
switchTab(8);
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
// Action functions
|
| 279 |
+
function calculateYield() {
|
| 280 |
+
const modal = document.createElement('div');
|
| 281 |
+
modal.className = 'fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center';
|
| 282 |
+
modal.innerHTML = `
|
| 283 |
+
<div class="bg-white rounded-lg p-6 m-4 max-w-sm w-full">
|
| 284 |
+
<h3 class="text-lg font-bold mb-4">คำนวณผลผลิตใหม่</h3>
|
| 285 |
+
<div class="space-y-3">
|
| 286 |
+
<input type="number" placeholder="พื้นที่ (ไร่)" class="w-full p-3 border rounded-lg">
|
| 287 |
+
<input type="number" placeholder="ผลผลิตปีที่แล้ว (ตัน)" class="w-full p-3 border rounded-lg">
|
| 288 |
+
<select class="w-full p-3 border rounded-lg">
|
| 289 |
+
<option>ข้าวโพดหวาน</option>
|
| 290 |
+
<option>ข้าวหอมมะลิ</option>
|
| 291 |
+
<option>มะละกอ</option>
|
| 292 |
+
<option>มะเขือเทศ</option>
|
| 293 |
+
</select>
|
| 294 |
+
</div>
|
| 295 |
+
<div class="flex space-x-2 mt-4">
|
| 296 |
+
<button onclick="this.closest('.fixed').remove()" class="flex-1 bg-gray-300 text-gray-700 py-2 rounded-lg">
|
| 297 |
+
ยกเลิก
|
| 298 |
+
</button>
|
| 299 |
+
<button onclick="calculateNewYield(this)" class="flex-1 bg-green-600 text-white py-2 rounded-lg">
|
| 300 |
+
คำนวณ
|
| 301 |
+
</button>
|
| 302 |
+
</div>
|
| 303 |
+
</div>
|
| 304 |
+
`;
|
| 305 |
+
document.body.appendChild(modal);
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
function calculateNewYield(button) {
|
| 309 |
+
button.innerHTML = '<div class="spinner inline-block w-4 h-4"></div>';
|
| 310 |
+
setTimeout(() => {
|
| 311 |
+
button.closest('.fixed').remove();
|
| 312 |
+
showSuccessToast('คำนวณผลผลิตสำเร็จ! คาดว่าผลผลิตเพิ่มขึ้น 35%');
|
| 313 |
+
}, 1000);
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
function viewNationalPrices() {
|
| 317 |
+
showSuccessToast('กำลังโหลดข้อมูลราคาทั่วประเทศ...');
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
function downloadPDF() {
|
| 321 |
+
showSuccessToast('กำลังดาวน์โหลด Crop Cycle เป็น PDF...');
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
function addProduct() {
|
| 325 |
+
const modal = document.createElement('div');
|
| 326 |
+
modal.className = 'fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center';
|
| 327 |
+
modal.innerHTML = `
|
| 328 |
+
<div class="bg-white rounded-lg p-6 m-4 max-w-sm w-full">
|
| 329 |
+
<h3 class="text-lg font-bold mb-4">เพิ่มผลผลิตใหม่</h3>
|
| 330 |
+
<div class="space-y-3">
|
| 331 |
+
<input type="text" placeholder="ชื่อผลผลิต" class="w-full p-3 border rounded-lg">
|
| 332 |
+
<input type="number" placeholder="ปริมาณ (กก.)" class="w-full p-3 border rounded-lg">
|
| 333 |
+
<input type="number" placeholder="ราคาขายที่เสนอ (บาท/กก.)" class="w-full p-3 border rounded-lg">
|
| 334 |
+
<input type="date" class="w-full p-3 border rounded-lg">
|
| 335 |
+
</div>
|
| 336 |
+
<div class="flex space-x-2 mt-4">
|
| 337 |
+
<button onclick="this.closest('.fixed').remove()" class="flex-1 bg-gray-300 text-gray-700 py-2 rounded-lg">
|
| 338 |
+
ยกเลิก
|
| 339 |
+
</button>
|
| 340 |
+
<button onclick="submitProduct(this)" class="flex-1 bg-green-600 text-white py-2 rounded-lg">
|
| 341 |
+
บันทึก
|
| 342 |
+
</button>
|
| 343 |
+
</div>
|
| 344 |
+
</div>
|
| 345 |
+
`;
|
| 346 |
+
document.body.appendChild(modal);
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
function submitProduct(button) {
|
| 350 |
+
button.innerHTML = '<div class="spinner inline-block w-4 h-4"></div>';
|
| 351 |
+
setTimeout(() => {
|
| 352 |
+
button.closest('.fixed').remove();
|
| 353 |
+
showSuccessToast('เพิ่มผลผลิตสำเร็จ! กำลังจับคู่ผู้ซื้อ...');
|
| 354 |
+
}, 1000);
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
function becomeCoach() {
|
| 358 |
+
showSuccessToast('กำลังดำเนินการสมัคร... ทีมงานจะติดต่อกลับโดยเร็ว!');
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
// Toast notification
|
| 362 |
+
function showSuccessToast(message) {
|
| 363 |
+
const toast = document.createElement('div');
|
| 364 |
+
toast.className = 'fixed top-20 left-4 right-4 bg-green-600 text-white p-4 rounded-lg shadow-lg z-50 success-animation';
|
| 365 |
+
toast.innerHTML = `
|
| 366 |
+
<div class="flex items-center space-x-2">
|
| 367 |
+
<i data-feather="check-circle" class="w-5 h-5"></i>
|
| 368 |
+
<span>${message}</span>
|
| 369 |
+
</div>
|
| 370 |
+
`;
|
| 371 |
+
document.body.appendChild(toast);
|
| 372 |
+
feather.replace();
|
| 373 |
+
|
| 374 |
+
setTimeout(() => {
|
| 375 |
+
toast.remove();
|
| 376 |
+
}, 3000);
|
| 377 |
+
}
|
| 378 |
+
|
| 379 |
+
// Simulate real-time price updates
|
| 380 |
+
setInterval(() => {
|
| 381 |
+
const priceElements = document.querySelectorAll('.text-green-600, .text-red-600');
|
| 382 |
+
priceElements.forEach(el => {
|
| 383 |
+
if (el.textContent.includes('↑') || el.textContent.includes('↓')) {
|
| 384 |
+
// Simulate price change animation
|
| 385 |
+
el.style.transform = 'scale(1.1)';
|
| 386 |
+
setTimeout(() => {
|
| 387 |
+
el.style.transform = 'scale(1)';
|
| 388 |
+
}, 200);
|
| 389 |
+
}
|
| 390 |
+
});
|
| 391 |
+
}, 5000);
|
| 392 |
+
|
| 393 |
+
// Pull to refresh functionality
|
| 394 |
+
let startY = 0;
|
| 395 |
+
let isPulling = false;
|
| 396 |
+
|
| 397 |
+
document.addEventListener('touchstart', (e) => {
|
| 398 |
+
if (window.scrollY === 0) {
|
| 399 |
+
startY = e.touches[0].pageY;
|
| 400 |
+
isPulling = true;
|
| 401 |
+
}
|
| 402 |
+
});
|
| 403 |
+
|
| 404 |
+
document.addEventListener('touchmove', (e) => {
|
| 405 |
+
if (!isPulling) return;
|
| 406 |
+
|
| 407 |
+
const currentY = e.touches[0].pageY;
|
| 408 |
+
const pullDistance = currentY - startY;
|
| 409 |
+
|
| 410 |
+
if (pullDistance > 100 && window.scrollY === 0) {
|
| 411 |
+
// Show refresh indicator
|
| 412 |
+
showRefreshIndicator();
|
| 413 |
+
}
|
| 414 |
+
});
|
| 415 |
+
|
| 416 |
+
document.addEventListener('touchend', () => {
|
| 417 |
+
if (isPulling) {
|
| 418 |
+
isPulling = false;
|
| 419 |
+
hideRefreshIndicator();
|
| 420 |
+
}
|
| 421 |
+
});
|
| 422 |
+
|
| 423 |
+
function showRefreshIndicator() {
|
| 424 |
+
const indicator = document.createElement('div');
|
| 425 |
+
indicator.id = 'refreshIndicator';
|
| 426 |
+
indicator.className = 'fixed top-16 left-0 right-0 bg-green-600 text-white text-center py-2 z-40';
|
| 427 |
+
indicator.textContent = 'กำลังรีเฟรชข้อมูล...';
|
| 428 |
+
document.body.appendChild(indicator);
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
function hideRefreshIndicator() {
|
| 432 |
+
const indicator = document.getElementById('refreshIndicator');
|
| 433 |
+
if (indicator) {
|
| 434 |
+
indicator.remove();
|
| 435 |
+
}
|
| 436 |
+
}
|
|
@@ -1,28 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
body {
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
}
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
}
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
margin-bottom: 10px;
|
| 15 |
-
margin-top: 5px;
|
| 16 |
}
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
}
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Custom styles for JaiKaset Smart Farm */
|
| 2 |
+
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');
|
| 3 |
+
|
| 4 |
body {
|
| 5 |
+
font-family: 'Prompt', sans-serif;
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
.tab-content {
|
| 9 |
+
animation: fadeIn 0.3s ease-in-out;
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
@keyframes fadeIn {
|
| 13 |
+
from {
|
| 14 |
+
opacity: 0;
|
| 15 |
+
transform: translateY(10px);
|
| 16 |
+
}
|
| 17 |
+
to {
|
| 18 |
+
opacity: 1;
|
| 19 |
+
transform: translateY(0);
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
.nav-btn.active {
|
| 24 |
+
color: #16a34a;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
.nav-btn:hover {
|
| 28 |
+
color: #16a34a;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
/* Chart canvas styling */
|
| 32 |
+
canvas {
|
| 33 |
+
max-width: 100%;
|
| 34 |
+
height: auto;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
/* Custom scrollbar for mobile */
|
| 38 |
+
::-webkit-scrollbar {
|
| 39 |
+
width: 4px;
|
| 40 |
+
height: 4px;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
::-webkit-scrollbar-track {
|
| 44 |
+
background: #f1f1f1;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
::-webkit-scrollbar-thumb {
|
| 48 |
+
background: #16a34a;
|
| 49 |
+
border-radius: 2px;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
/* Smooth transitions */
|
| 53 |
+
* {
|
| 54 |
+
transition: all 0.2s ease;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
/* Responsive design */
|
| 58 |
+
@media (max-width: 640px) {
|
| 59 |
+
main {
|
| 60 |
+
padding-bottom: 80px;
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
/* Custom animations */
|
| 65 |
+
@keyframes pulse {
|
| 66 |
+
0% {
|
| 67 |
+
transform: scale(1);
|
| 68 |
+
}
|
| 69 |
+
50% {
|
| 70 |
+
transform: scale(1.05);
|
| 71 |
+
}
|
| 72 |
+
100% {
|
| 73 |
+
transform: scale(1);
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
.pulse-animation {
|
| 78 |
+
animation: pulse 2s infinite;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
/* Loading spinner */
|
| 82 |
+
@keyframes spin {
|
| 83 |
+
0% { transform: rotate(0deg); }
|
| 84 |
+
100% { transform: rotate(360deg); }
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
.spinner {
|
| 88 |
+
border: 3px solid #f3f3f3;
|
| 89 |
+
border-top: 3px solid #16a34a;
|
| 90 |
+
border-radius: 50%;
|
| 91 |
+
width: 30px;
|
| 92 |
+
height: 30px;
|
| 93 |
+
animation: spin 1s linear infinite;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
/* Badge styles */
|
| 97 |
+
.badge {
|
| 98 |
+
display: inline-block;
|
| 99 |
+
padding: 0.25rem 0.5rem;
|
| 100 |
+
font-size: 0.75rem;
|
| 101 |
+
font-weight: 600;
|
| 102 |
+
border-radius: 9999px;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
.badge-success {
|
| 106 |
+
background-color: #dcfce7;
|
| 107 |
+
color: #16a34a;
|
| 108 |
}
|
| 109 |
|
| 110 |
+
.badge-warning {
|
| 111 |
+
background-color: #fef3c7;
|
| 112 |
+
color: #d97706;
|
| 113 |
}
|
| 114 |
|
| 115 |
+
.badge-danger {
|
| 116 |
+
background-color: #fee2e2;
|
| 117 |
+
color: #dc2626;
|
|
|
|
|
|
|
| 118 |
}
|
| 119 |
|
| 120 |
+
/* Card hover effects */
|
| 121 |
+
.card-hover:hover {
|
| 122 |
+
transform: translateY(-2px);
|
| 123 |
+
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
|
|
|
|
|
|
|
| 124 |
}
|
| 125 |
|
| 126 |
+
/* Input field focus styles */
|
| 127 |
+
input:focus, select:focus, textarea:focus {
|
| 128 |
+
outline: none;
|
| 129 |
+
border-color: #16a34a;
|
| 130 |
+
box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
|
| 131 |
}
|
| 132 |
+
|
| 133 |
+
/* Tab indicator */
|
| 134 |
+
.tab-indicator {
|
| 135 |
+
height: 3px;
|
| 136 |
+
background: linear-gradient(90deg, #16a34a, #22c55e);
|
| 137 |
+
border-radius: 3px 3px 0 0;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
/* Custom button styles */
|
| 141 |
+
.btn-primary {
|
| 142 |
+
background: linear-gradient(135deg, #16a34a, #22c55e);
|
| 143 |
+
color: white;
|
| 144 |
+
padding: 0.75rem 1.5rem;
|
| 145 |
+
border-radius: 0.5rem;
|
| 146 |
+
font-weight: 600;
|
| 147 |
+
transition: all 0.3s ease;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
.btn-primary:hover {
|
| 151 |
+
transform: translateY(-2px);
|
| 152 |
+
box-shadow: 0 10px 20px rgba(22, 163, 74, 0.3);
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
/* Glass morphism effect */
|
| 156 |
+
.glass {
|
| 157 |
+
background: rgba(255, 255, 255, 0.9);
|
| 158 |
+
backdrop-filter: blur(10px);
|
| 159 |
+
border: 1px solid rgba(255, 255, 255, 0.3);
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
/* Success animation */
|
| 163 |
+
@keyframes success {
|
| 164 |
+
0% {
|
| 165 |
+
transform: scale(0) rotate(-180deg);
|
| 166 |
+
opacity: 0;
|
| 167 |
+
}
|
| 168 |
+
100% {
|
| 169 |
+
transform: scale(1) rotate(0deg);
|
| 170 |
+
opacity: 1;
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
.success-animation {
|
| 175 |
+
animation: success 0.5s ease-out;
|
| 176 |
+
}
|