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.
 
 
 
 
 
 

105 lines
3.2 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;
int? tipe_peti_id;
String? warna;
final String fix_lot;
int? packing_no;
int? customer_id;
int? jumlah;
DateTime? date_pembuatan;
int? warehouse_id;
int? kondisipeti_id;
String? status;
String? created_by;
String? updated_by;
DateTime? created_at;
DateTime? updated_at;
DateTime? deleted_at;
PetiAssetModel({
this.id,
this.tipe_peti_id,
this.warna,
required this.fix_lot,
this.packing_no,
this.customer_id,
this.jumlah,
this.date_pembuatan,
this.warehouse_id,
this.kondisipeti_id,
this.status,
this.created_by,
this.updated_by,
this.created_at,
this.updated_at,
this.deleted_at,
});
factory PetiAssetModel.fromJson(Map<String, dynamic> json) {
return PetiAssetModel(
id: json['id'],
tipe_peti_id: json['tipe_peti_id'] != null
? int.parse(json['tipe_peti_id'].toString())
: null,
warna: json['warna'] != null ? json['warna'].toString() : null,
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,
kondisipeti_id: json['kondisipeti_id'] != null
? int.parse(json['kondisipeti_id'].toString())
: null,
status: json['status'] != null ? json['status'].toString() : null,
jumlah:
json['jumlah'] != null ? int.parse(json['jumlah'].toString()) : null,
date_pembuatan: json['date_pembuatan'] != null
? DateTime.parse(json['date_pembuatan'].toString())
: null,
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'],
created_at: json['created_at'] != null
? DateTime.parse(json['created_at'].toString())
: DateTime.now(),
updated_at: json['updated_at'] != null
? DateTime.parse(json['updated_at'].toString())
: DateTime.now(),
deleted_at: json['deleted_at'] != null
? DateTime.parse(json['deleted_at'].toString())
: DateTime.now(),
);
}
Map<String, dynamic> toJson() => {
'id': id,
'tipe_peti_id': tipe_peti_id,
'warna': warna,
'fix_lot': fix_lot.toString(),
'packing_no': packing_no,
'customer_id': customer_id,
'warehouse_id': warehouse_id,
'kondisipeti_id': kondisipeti_id,
'status': status,
'jumlah': jumlah,
'date_pembuatan': date_pembuatan!.toIso8601String(),
'created_by': created_by,
'updated_by': updated_by,
'created_at': created_at!.toIso8601String(),
'updated_at': updated_at!.toIso8601String(),
'deleted_at': deleted_at!.toIso8601String(),
};
}