Fixed sales invoice issues in Ecommerce
This commit is contained in:
49
kifi-app/lib/features/sales/domain/sales_channel.dart
Normal file
49
kifi-app/lib/features/sales/domain/sales_channel.dart
Normal file
@@ -0,0 +1,49 @@
|
||||
class SalesChannel {
|
||||
final int? id;
|
||||
final int? userId;
|
||||
final String name;
|
||||
final String? code;
|
||||
final String? icon;
|
||||
final int? defaultLedgerId;
|
||||
final bool isActive;
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
SalesChannel({
|
||||
this.id,
|
||||
this.userId,
|
||||
required this.name,
|
||||
this.code,
|
||||
this.icon,
|
||||
this.defaultLedgerId,
|
||||
this.isActive = true,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
factory SalesChannel.fromJson(Map<String, dynamic> json) {
|
||||
return SalesChannel(
|
||||
id: json['id'],
|
||||
userId: json['userId'] ?? json['user_id'],
|
||||
name: json['name'] ?? '',
|
||||
code: json['code'],
|
||||
icon: json['icon'],
|
||||
defaultLedgerId: json['defaultLedgerId'] ?? json['default_ledger_id'],
|
||||
isActive: json['isActive'] ?? json['is_active'] ?? true,
|
||||
createdAt: json['createdAt'] != null ? DateTime.tryParse(json['createdAt']) : null,
|
||||
updatedAt: json['updatedAt'] != null ? DateTime.tryParse(json['updatedAt']) : null,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
if (id != null) 'id': id,
|
||||
if (userId != null) 'userId': userId,
|
||||
'name': name,
|
||||
if (code != null) 'code': code,
|
||||
if (icon != null) 'icon': icon,
|
||||
if (defaultLedgerId != null) 'defaultLedgerId': defaultLedgerId,
|
||||
'isActive': isActive,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user