Siopas Inventory PETI for ISTW Mobile
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
2.8 KiB

import 'package:siopas/models/customer_model.dart';
import 'package:siopas/models/type_peti_model.dart';
import 'package:siopas/models/warehouse_mode.dart';
class PetiAssetModel {
int? id;
String? tipe_peti_id;
String? warna;
String? fix_lot;
int? packing_no;
int? customer_id;
int? warehouse_id;
int? jumlah;
DateTime? date_pembuatan;
WarehouseModel? warehouse;
TypePetiModel? tipe_peti;
CustomerModel? customer;
String? status_disposal;
String? created_by;
String? updated_by;
// late WarehouseModel warehouse;
PetiAssetModel({
this.id,
this.tipe_peti_id,
this.warna,
this.fix_lot,
this.packing_no,
this.customer_id,
this.warehouse_id,
this.jumlah,
this.date_pembuatan,
this.warehouse,
this.tipe_peti,
this.customer,
this.status_disposal,
this.created_by,
this.updated_by,
// required this.warehouse,
});
factory PetiAssetModel.fromJson(Map<String, dynamic> json) {
return PetiAssetModel(
id: json['id'],
tipe_peti_id: json['tipe_peti_id'],
warna: json['warna'],
fix_lot: json['fix_lot'],
packing_no: json['packing_no'] != null
? int.parse(json['packing_no'].toString())
: null,
customer_id: json['customer_id'] != null
? int.parse(json['customer_id'].toString())
: null,
warehouse_id: json['warehouse_id'] != null
? int.parse(json['warehouse_id'].toString())
: null,
jumlah:
json['jumlah'] != null ? int.parse(json['jumlah'].toString()) : null,
date_pembuatan: DateTime.parse(json['date_pembuatan']),
warehouse: json['warehouse'] != null
? WarehouseModel.fromJson(json['warehouse'])
: null,
tipe_peti: json['tipe_peti'] != null
? TypePetiModel.fromJson(json['tipe_peti'])
: null,
customer: json['customer'] != null
? CustomerModel.fromJson(json['customer'])
: null,
status_disposal: json['status_disposal'],
created_by: json['created_by'] != null
? json['created_by'].toString()
: json['created_by'],
updated_by: json['updated_by'] != null
? json['updated_by'].toString()
: json['updated_by'],
);
}
Map<String, dynamic> toJson() => {
'id': id,
'tipe_peti_id': tipe_peti_id,
'warna': warna,
'fix_lot': fix_lot,
'packing_no': packing_no,
'customer_id': customer_id,
'warehouse_id': warehouse_id,
'jumlah': jumlah,
'date_pembuatan': date_pembuatan!.toIso8601String(),
'warehouse': warehouse!.toJson(),
'tipe_peti': tipe_peti!.toJson(),
'customer': customer!.toJson(),
'status_disposal': status_disposal,
'created_by': created_by,
'updated_by': updated_by,
};
}