first commit

This commit is contained in:
Aditya Siregar
2025-07-30 22:38:44 +07:00
commit 73320561b0
444 changed files with 64633 additions and 0 deletions
@@ -0,0 +1,17 @@
import '../../home/models/product_category.dart';
class DiscountModel {
final String name;
final String code;
final int discount;
final ProductCategory category;
final String? description;
DiscountModel({
required this.name,
required this.code,
required this.discount,
required this.category,
required this.description,
});
}
@@ -0,0 +1,31 @@
enum PrinterType {
wifi('Wifi'),
bluetooth('Bluetooth');
final String value;
const PrinterType(this.value);
bool get isWifi => this == PrinterType.wifi;
bool get isBluetooth => this == PrinterType.bluetooth;
factory PrinterType.fromValue(String value) {
return values.firstWhere(
(element) => element.value == value,
orElse: () => PrinterType.wifi,
);
}
}
class PrinterModel {
final String name;
final String ipAddress;
final String size;
final PrinterType type;
PrinterModel({
required this.name,
required this.ipAddress,
required this.size,
required this.type,
});
}
@@ -0,0 +1,44 @@
import 'dart:convert';
enum TaxType {
layanan,
pajak;
bool get isLayanan => this == TaxType.layanan;
bool get isPajak => this == TaxType.pajak;
}
class TaxModel {
final String name;
final TaxType type;
final int value;
TaxModel({
required this.name,
required this.type,
required this.value,
});
Map<String, dynamic> toMap() {
return {
'name': name,
'type': type.name,
'value': value,
};
}
factory TaxModel.fromMap(Map<String, dynamic> map) {
return TaxModel(
name: map['name'] ?? '',
type: TaxType.values.firstWhere(
(e) => e.name == map['type'],
orElse: () => TaxType.layanan,
),
value: map['value']?.toInt() ?? 0,
);
}
String toJson() => json.encode(toMap());
factory TaxModel.fromJson(String source) => TaxModel.fromMap(json.decode(source));
}