Files
fcs/lib/vo/inventory_taking.dart

44 lines
1005 B
Dart
Raw Normal View History

2020-05-29 07:45:27 +06:30
import 'package:cloud_firestore/cloud_firestore.dart';
import 'inventory_line.dart';
class InventoryTaking {
String accountID;
String id;
DateTime dateTime;
String userID;
String userName;
List<InventoryLine> inventoryLines = [];
bool linesLoaded = false;
InventoryTaking(
{this.accountID, this.id, this.userID, this.userName, this.dateTime});
factory InventoryTaking.fromMap(Map<String, dynamic> map, String id) {
var _dateTime = (map['date_time'] as Timestamp);
return InventoryTaking(
id: id,
accountID: map['account_id'],
userID: map['user_id'],
userName: map['user_name'],
dateTime: _dateTime?.toDate(),
);
}
Map<String, dynamic> toMap() {
List lines = inventoryLines.map((l) => l.toMap()).toList();
return {
'id': id,
'user_id': userID,
'user_name': userName,
'inventory_lines': lines,
};
}
@override
String toString() {
return 'InventoryTaking{id:$id,name:$userName}';
}
}