clean up
This commit is contained in:
45
lib/domain/vo/contact.dart
Normal file
45
lib/domain/vo/contact.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
import 'package:fcs/domain/entities/setting.dart';
|
||||
|
||||
class Contact {
|
||||
String usaAddress;
|
||||
String mmAddress;
|
||||
String usaContactNumber;
|
||||
String mmContactNumber;
|
||||
String emailAddress;
|
||||
String facebookLink;
|
||||
|
||||
Contact({
|
||||
this.usaAddress,
|
||||
this.mmAddress,
|
||||
this.usaContactNumber,
|
||||
this.mmContactNumber,
|
||||
this.emailAddress,
|
||||
this.facebookLink,
|
||||
});
|
||||
|
||||
factory Contact.fromSetting(Setting setting) {
|
||||
return Contact(
|
||||
usaContactNumber: setting.usaContactNumber,
|
||||
mmContactNumber: setting.mmContactNumber,
|
||||
usaAddress: setting.usaAddress,
|
||||
mmAddress: setting.mmAddress,
|
||||
emailAddress: setting.emailAddress,
|
||||
facebookLink: setting.facebookLink);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'usa_address': usaAddress,
|
||||
'mm_address': mmAddress,
|
||||
'usa_contact_number': usaContactNumber,
|
||||
'mm_contact_number': mmContactNumber,
|
||||
'email_address': emailAddress,
|
||||
'facebook_link': facebookLink,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Contact{usa_address:$usaAddress,mm_address:$mmAddress}';
|
||||
}
|
||||
}
|
||||
58
lib/domain/vo/message.dart
Normal file
58
lib/domain/vo/message.dart
Normal file
@@ -0,0 +1,58 @@
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
|
||||
class Message {
|
||||
String id;
|
||||
String message;
|
||||
DateTime date;
|
||||
String receiverID;
|
||||
String receiverName;
|
||||
String senderID;
|
||||
String senderName;
|
||||
String messageType;
|
||||
String messageID;
|
||||
|
||||
Message(
|
||||
{this.id,
|
||||
this.message,
|
||||
this.date,
|
||||
this.receiverID,
|
||||
this.receiverName,
|
||||
this.senderID,
|
||||
this.senderName,
|
||||
this.messageType,
|
||||
this.messageID});
|
||||
bool fromToday() {
|
||||
var now = DateTime.now();
|
||||
return date.day == now.day &&
|
||||
date.month == now.month &&
|
||||
date.year == now.year;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'message': message,
|
||||
"receiver_id": receiverID,
|
||||
};
|
||||
}
|
||||
|
||||
bool sameDay(Message another) {
|
||||
return date.year == another.date.year &&
|
||||
date.month == another.date.month &&
|
||||
date.day == another.date.day;
|
||||
}
|
||||
|
||||
factory Message.fromMap(Map<String, dynamic> map, String id) {
|
||||
var date = (map['date'] as Timestamp);
|
||||
return Message(
|
||||
id: id,
|
||||
message: map['message'],
|
||||
senderID: map['sender_id'],
|
||||
senderName: map['sender_name'],
|
||||
receiverID: map['receiver_id'],
|
||||
receiverName: map['receiver_name'],
|
||||
messageType: map['msg_type'],
|
||||
messageID: map['msg_id'],
|
||||
date: date != null ? date.toDate() : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
5
lib/domain/vo/radio.dart
Normal file
5
lib/domain/vo/radio.dart
Normal file
@@ -0,0 +1,5 @@
|
||||
class RadioGroup {
|
||||
String text;
|
||||
int index;
|
||||
RadioGroup({this.text, this.index});
|
||||
}
|
||||
17
lib/domain/vo/shipment_status.dart
Normal file
17
lib/domain/vo/shipment_status.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
|
||||
class ShipmentStatus {
|
||||
String status;
|
||||
DateTime date;
|
||||
bool done;
|
||||
ShipmentStatus({this.status, this.date, this.done});
|
||||
|
||||
factory ShipmentStatus.fromMap(Map<String, dynamic> map) {
|
||||
var _date = (map['date'] as Timestamp);
|
||||
return ShipmentStatus(
|
||||
status: map['status'],
|
||||
date: _date == null ? null : _date.toDate(),
|
||||
done: map['done'],
|
||||
);
|
||||
}
|
||||
}
|
||||
15
lib/domain/vo/shipping_address.dart
Normal file
15
lib/domain/vo/shipping_address.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
class ShippingAddress {
|
||||
String fullName;
|
||||
String addressLine1;
|
||||
String addressLine2;
|
||||
String city;
|
||||
String state;
|
||||
String phoneNumber;
|
||||
ShippingAddress(
|
||||
{this.fullName,
|
||||
this.addressLine1,
|
||||
this.addressLine2,
|
||||
this.city,
|
||||
this.state,
|
||||
this.phoneNumber});
|
||||
}
|
||||
13
lib/domain/vo/status.dart
Normal file
13
lib/domain/vo/status.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
class Status {
|
||||
String status;
|
||||
String message;
|
||||
String errorCode;
|
||||
Status(this.status, this.message);
|
||||
|
||||
Status.fromJson(Map<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
message = json['message'];
|
||||
errorCode = json['error_code'];
|
||||
}
|
||||
}
|
||||
24
lib/domain/vo/term.dart
Normal file
24
lib/domain/vo/term.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import 'package:fcs/domain/entities/setting.dart';
|
||||
|
||||
class Term {
|
||||
String termEng;
|
||||
String termMm;
|
||||
|
||||
Term({this.termEng, this.termMm});
|
||||
|
||||
factory Term.fromSetting(Setting setting) {
|
||||
return Term(termEng: setting.termsEng, termMm: setting.termsMm);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'terms_eng': termEng,
|
||||
'terms_mm': termMm,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Contact{terms_eng:$termEng}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user