Mitgliederladen/Frontend-user/lib/sample_data.dart

205 lines
5.4 KiB
Dart

final DateTime now = DateTime.now();
enum TransaktionArt { monatlBeitrag, aufladung, einkauf, korrektur }
enum Unit { stueck, menge }
class Category {
final String name;
final String icon;
const Category({required this.name, required this.icon});
}
class Transaction {
int id = 0;
int amount;
TransaktionArt type;
DateTime date;
List<Basket>? basket;
String? description;
Transaction(
{required this.type,
required this.amount,
required this.date,
this.description,
this.basket});
}
class Product {
final int id = 0;
final String name;
final Unit unit;
final double price; //pro Kilogramm oder Stück
final double vat;
final Category category;
const Product(this.name, this.unit, this.price, this.vat, this.category);
}
class Basket {
Product products;
int amount;
Basket(this.products, this.amount);
}
class SampleData {
static const List<Category> categories = [
Category(name: 'Obst und Gemüse', icon: '🍒'),
Category(name: 'Kochen und Backen', icon: '🍝'),
Category(name: 'Brot, Cerealien & Aufstriche', icon: '🍞'),
Category(name: 'Getränke und Pfand', icon: '🫖'),
Category(name: 'Drogerie und Haushalt', icon: '🧼'),
Category(name: 'Öl, Soßen und Gewürze', icon: '🫚'),
Category(name: 'Süßes und Knabbereien', icon: '🍪')
];
static List<Product> products = [
Product('Apfel', Unit.stueck, 0.23, 7, categories[0]),
Product('Mehl', Unit.menge, 0.003, 19, categories[1]),
Product('Brot', Unit.stueck, 1.23, 7, categories[2]),
Product('Milch', Unit.stueck, 2.23, 3, categories[3]),
Product('Zahnpasta', Unit.stueck, 0.23, 7, categories[4]),
Product('Pfeffer', Unit.stueck, 0.23, 7, categories[5]),
Product('Schokolade', Unit.menge, 0.23, 7, categories[6]),
Product('Flaschenpfand', Unit.stueck, -0.15, 0, categories[3])
];
static List<Basket> basket = [
Basket(products[0], 20),
Basket(products[1], 2200),
Basket(products[2], 2),
Basket(products[3], 1),
Basket(products[4], 1),
Basket(products[5], 2),
Basket(products[6], 222),
Basket(products[0], 20),
Basket(products[1], 2200),
Basket(products[2], 2),
Basket(products[3], 1),
Basket(products[4], 1),
Basket(products[5], 2),
Basket(products[6], 222)
];
static List<Basket> basket2 = [
Basket(products[0], 22),
Basket(products[1], 2241),
Basket(products[3], 2),
Basket(products[4], 4),
Basket(products[6], 2),
Basket(products[7], 5)
];
static List<Basket> basket3 = [
Basket(products[0], -2),
Basket(products[1], 21),
Basket(products[3], -4),
Basket(products[4], 1),
Basket(products[6], 5)
];
List<Transaction> transactions = [
Transaction(
type: TransaktionArt.monatlBeitrag,
amount: 0,
date: now,
),
Transaction(
type: TransaktionArt.aufladung,
amount: 2042,
date: now,
),
Transaction(
type: TransaktionArt.einkauf,
amount: -2442,
date: now.subtract(const Duration(days: 2)),
basket: basket),
Transaction(
type: TransaktionArt.korrektur,
amount: 2332,
date: now.subtract(const Duration(hours: 5)),
description: 'Korrektur des Warenkorbs',
basket: basket3,
),
Transaction(
type: TransaktionArt.monatlBeitrag,
amount: 0,
date: now,
),
Transaction(
type: TransaktionArt.aufladung,
amount: 2042,
date: now,
),
Transaction(
type: TransaktionArt.einkauf,
amount: -2442,
date: now.subtract(const Duration(days: 2)),
basket: basket2),
Transaction(
type: TransaktionArt.korrektur,
amount: 2332,
date: now.subtract(const Duration(hours: 5)),
description: 'Korrektur des FinanzAK'),
Transaction(
type: TransaktionArt.monatlBeitrag,
amount: 0,
date: now,
),
Transaction(
type: TransaktionArt.aufladung,
amount: 2042,
date: now,
),
Transaction(
type: TransaktionArt.einkauf,
amount: -2442,
date: now.subtract(const Duration(days: 2)),
basket: basket,
),
Transaction(
type: TransaktionArt.korrektur,
amount: 2332,
date: now.subtract(const Duration(hours: 5)),
description: 'Korrektur des Warenkorbs'),
Transaction(
type: TransaktionArt.monatlBeitrag,
amount: 0,
date: now,
),
Transaction(
type: TransaktionArt.aufladung,
amount: 2042,
date: now,
),
Transaction(
type: TransaktionArt.einkauf,
amount: -2442,
date: now.subtract(const Duration(days: 2)),
basket: basket),
Transaction(
type: TransaktionArt.korrektur,
amount: 2332,
date: now.subtract(const Duration(hours: 5)),
description: 'Korrektur des Warenkorbs'),
Transaction(
type: TransaktionArt.monatlBeitrag,
amount: 0,
date: now,
),
Transaction(
type: TransaktionArt.aufladung,
amount: 2042,
date: now,
),
Transaction(
type: TransaktionArt.einkauf,
amount: -2442,
date: now.subtract(const Duration(days: 2)),
basket: basket2),
Transaction(
type: TransaktionArt.korrektur,
amount: 2332,
date: now.subtract(const Duration(hours: 5)),
description: 'Korrektur des Warenkorbs'),
];
}