fix tampilan atau front end laporan

This commit is contained in:
rhanarmt 2026-05-11 15:43:44 +07:00
parent 6ad544fb75
commit 97ceebb831
10 changed files with 709 additions and 447 deletions

View File

@ -372,10 +372,12 @@ class _DashboardScreenState extends State<DashboardScreen> {
const SizedBox(width: 12),
Expanded(
child: ElevatedButton.icon(
onPressed: () {},
onPressed: () {
Navigator.of(context).pushNamed('/transaction');
},
icon: const Icon(Icons.check_circle, size: 20),
label: const Text(
'Rekomendasi Stok',
'Tambah Stok',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
@ -440,7 +442,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
),
BottomNavigationBarItem(
icon: Icon(Icons.shopping_cart_outlined),
label: 'Stock In',
label: 'Stok Masuk',
),
BottomNavigationBarItem(
icon: Icon(Icons.trending_up_outlined),

View File

@ -1218,7 +1218,7 @@ class _PredictionScreenState extends State<PredictionScreen> {
),
BottomNavigationBarItem(
icon: Icon(Icons.shopping_cart_outlined),
label: 'Stock In',
label: 'Stok Masuk',
),
BottomNavigationBarItem(
icon: Icon(Icons.trending_up_outlined),

View File

@ -338,7 +338,7 @@ class _ProductListScreenState extends State<ProductListScreen> with RouteAware {
),
BottomNavigationBarItem(
icon: Icon(Icons.shopping_cart_outlined),
label: 'Stock In',
label: 'Stok Masuk',
),
BottomNavigationBarItem(
icon: Icon(Icons.trending_up_outlined),

File diff suppressed because it is too large Load Diff

View File

@ -391,7 +391,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
BottomNavigationBarItem(
icon: Icon(Icons.shopping_cart_outlined),
label: 'Stock In',
label: 'Stok Masuk',
),
BottomNavigationBarItem(
icon: Icon(Icons.trending_up_outlined),

View File

@ -71,7 +71,7 @@ class _TransactionScreenState extends State<TransactionScreen> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'⚠️ $successCount/$totalCount Stock In berhasil. Error: $firstError',
'⚠️ $successCount/$totalCount Stok Masuk berhasil. Error: $firstError',
),
backgroundColor: AppColors.statusError,
),
@ -80,7 +80,7 @@ class _TransactionScreenState extends State<TransactionScreen> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'$successCount Stock In berhasil disimpan dan stok terupdate!',
'$successCount Stok Masuk berhasil disimpan dan stok terupdate!',
),
backgroundColor: AppColors.statusSuccess,
),
@ -446,7 +446,7 @@ class _TransactionScreenState extends State<TransactionScreen> {
backgroundColor: AppColors.primaryBrown,
elevation: 0,
title: Text(
' Stock In',
' Stok Masuk',
style: AppTextStyles.headlineLarge.copyWith(color: Colors.white),
),
leading: IconButton(
@ -765,7 +765,7 @@ class _TransactionScreenState extends State<TransactionScreen> {
),
const SizedBox(height: 16),
Text(
'Tanggal Stock In',
'Tanggal Stok Masuk',
style: AppTextStyles.labelLarge.copyWith(
color: AppColors.textPrimary,
),
@ -846,7 +846,7 @@ class _TransactionScreenState extends State<TransactionScreen> {
label: Text(
_controller.isLoading
? 'Menyimpan...'
: 'Simpan Stock In',
: 'Simpan Stok Masuk',
style: AppTextStyles.labelLarge,
),
),
@ -857,7 +857,7 @@ class _TransactionScreenState extends State<TransactionScreen> {
const SizedBox(height: 24),
],
Text(
'Riwayat Stock In (${_controller.transactions.length})',
'Riwayat Stok Masuk (${_controller.transactions.length})',
style: AppTextStyles.headlineSmall.copyWith(
color: AppColors.textPrimary,
),
@ -876,7 +876,7 @@ class _TransactionScreenState extends State<TransactionScreen> {
),
const SizedBox(height: 16),
Text(
'Belum ada Stock In',
'Belum ada Stok Masuk',
style: AppTextStyles.bodyMedium.copyWith(
color: AppColors.textSecondary,
),
@ -987,7 +987,7 @@ class _TransactionScreenState extends State<TransactionScreen> {
),
BottomNavigationBarItem(
icon: Icon(Icons.shopping_cart_outlined),
label: 'Stock In',
label: 'Stok Masuk',
),
BottomNavigationBarItem(
icon: Icon(Icons.trending_up_outlined),

View File

@ -5,7 +5,7 @@ class MLService {
// API URL - Change based on environment
// Untuk emulator Android: 10.0.2.2
// Untuk device fisik: 192.168.x.x atau 127.0.0.1 kalau local
static const String baseUrl = 'http://10.103.65.129:5000';
static const String baseUrl = 'http://192.168.18.30:5000';
static const int timeoutSeconds = 30;

View File

@ -29,6 +29,9 @@ DB_USER = 'root'
DB_PASSWORD = '' # Ganti dengan password MySQL Anda jika ada
DB_NAME = 'prediksi_stok_db'
# Table names (use backticks for names with spaces)
TRANSACTIONS_TABLE = "`Stock In`"
def get_db_connection():
"""Get MySQL database connection"""
try:
@ -686,8 +689,8 @@ def save_transaction():
return jsonify({'status': 'error', 'message': 'Database connection failed'}), 500
cursor = connection.cursor()
cursor.execute("""
INSERT INTO transactions
cursor.execute(f"""
INSERT INTO {TRANSACTIONS_TABLE}
(product_name, category, quantity, unit_price, total_price, transaction_date)
VALUES (%s, %s, %s, %s, %s, %s)
""", (
@ -762,8 +765,8 @@ def add_transaction_with_stock_update():
}), 404
# 2. Save transaction
cursor.execute("""
INSERT INTO transactions
cursor.execute(f"""
INSERT INTO {TRANSACTIONS_TABLE}
(product_name, category, quantity, unit_price, total_price, transaction_date)
VALUES (%s, %s, %s, %s, %s, %s)
""", (
@ -821,7 +824,7 @@ def get_transactions():
cursor = connection.cursor(dictionary=True)
# Build query
query = "SELECT * FROM transactions WHERE 1=1"
query = f"SELECT * FROM {TRANSACTIONS_TABLE} WHERE 1=1"
params = []
if product_name:
@ -835,7 +838,7 @@ def get_transactions():
transactions = cursor.fetchall()
# Get total count
cursor.execute("SELECT COUNT(*) as total FROM transactions" +
cursor.execute(f"SELECT COUNT(*) as total FROM {TRANSACTIONS_TABLE}" +
(" WHERE product_name LIKE %s" if product_name else ""),
([f"%{product_name}%"] if product_name else []))
total = cursor.fetchone()['total']

View File

@ -49,6 +49,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.8"
equatable:
dependency: transitive
description:
name: equatable
sha256: "3e0141505477fd8ad55d6eb4e7776d3fe8430be8e497ccb1521370c3f21a3e2b"
url: "https://pub.dev"
source: hosted
version: "2.0.8"
fake_async:
dependency: transitive
description:
@ -57,6 +65,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
fl_chart:
dependency: "direct main"
description:
name: fl_chart
sha256: "00b74ae680df6b1135bdbea00a7d1fc072a9180b7c3f3702e4b19a9943f5ed7d"
url: "https://pub.dev"
source: hosted
version: "0.66.2"
flutter:
dependency: "direct main"
description: flutter

View File

@ -41,6 +41,9 @@ dependencies:
# Intl untuk date formatting
intl: ^0.19.0
# Charts
fl_chart: ^0.66.2
dev_dependencies:
flutter_test:
sdk: flutter