65 lines
1.5 KiB
Dart
65 lines
1.5 KiB
Dart
|
import 'package:sk_base_mobile/models/sale_quotation.model.dart';
|
||
|
|
||
|
class SaleQuotationTemplateModel {
|
||
|
SaleQuotationTemplateModel({
|
||
|
this.id,
|
||
|
this.name,
|
||
|
required this.template,
|
||
|
this.isDelete,
|
||
|
});
|
||
|
|
||
|
final int? id;
|
||
|
final String? name;
|
||
|
final Template template;
|
||
|
final int? isDelete;
|
||
|
|
||
|
factory SaleQuotationTemplateModel.fromJson(Map<String, dynamic> json) {
|
||
|
return SaleQuotationTemplateModel(
|
||
|
id: json["id"],
|
||
|
name: json["name"],
|
||
|
template: Template.fromJson(json["template"]),
|
||
|
isDelete: json["isDelete"],
|
||
|
);
|
||
|
}
|
||
|
|
||
|
Map<String, dynamic> toJson() => {
|
||
|
"id": id,
|
||
|
"name": name,
|
||
|
"template": template.toJson(),
|
||
|
"isDelete": isDelete,
|
||
|
};
|
||
|
}
|
||
|
|
||
|
class Template {
|
||
|
Template({
|
||
|
required this.data,
|
||
|
required this.formula,
|
||
|
required this.totalCost,
|
||
|
required this.totalPrice,
|
||
|
});
|
||
|
|
||
|
List<SaleQuotationModel> data;
|
||
|
String formula;
|
||
|
num? totalCost;
|
||
|
num? totalPrice;
|
||
|
|
||
|
factory Template.fromJson(Map<String, dynamic> json) {
|
||
|
return Template(
|
||
|
data: json["data"] == null
|
||
|
? []
|
||
|
: List<SaleQuotationModel>.from(
|
||
|
json["data"]!.map((x) => SaleQuotationModel.fromJson(x))),
|
||
|
formula: json["formula"],
|
||
|
totalCost: json["totalCost"],
|
||
|
totalPrice: json["totalPrice"],
|
||
|
);
|
||
|
}
|
||
|
|
||
|
Map<String, dynamic> toJson() => {
|
||
|
"data": data.map((x) => x.toJson()).toList(),
|
||
|
"formula": formula,
|
||
|
"totalCost": totalCost,
|
||
|
"totalPrice": totalPrice,
|
||
|
};
|
||
|
}
|