45 lines
905 B
Dart
45 lines
905 B
Dart
class Discount {
|
|
String? id;
|
|
String? code;
|
|
String? customerId;
|
|
String? customerName;
|
|
String? status;
|
|
double amount;
|
|
|
|
Discount({
|
|
this.id,
|
|
this.code,
|
|
this.customerId,
|
|
this.customerName,
|
|
this.amount = 0,
|
|
this.status,
|
|
});
|
|
|
|
Map<String, dynamic> toMap() {
|
|
return {
|
|
'id': id,
|
|
'code': code,
|
|
"customer_id": customerId,
|
|
"customer_name": customerName,
|
|
"amount": amount,
|
|
};
|
|
}
|
|
|
|
factory Discount.fromMap(Map<String, dynamic> map, String id) {
|
|
return Discount(
|
|
id: id,
|
|
code: map['code'],
|
|
customerId: map['customer_id'],
|
|
customerName: map['customer_name'],
|
|
amount: map['amount'],
|
|
status: map['status'],
|
|
);
|
|
}
|
|
|
|
bool isChangedForEdit(Discount discount) {
|
|
return discount.code != this.code ||
|
|
discount.amount != this.amount ||
|
|
discount.customerId != this.customerId;
|
|
}
|
|
}
|