89 lines
1.9 KiB
Dart
89 lines
1.9 KiB
Dart
class LockerModel {
|
|
final int id;
|
|
final String nomorLoker;
|
|
final String status;
|
|
final String rfid;
|
|
|
|
LockerModel({
|
|
required this.id,
|
|
required this.nomorLoker,
|
|
required this.status,
|
|
required this.rfid,
|
|
});
|
|
|
|
// Untuk memparsing JSON menjadi objek LockerModel
|
|
factory LockerModel.fromJson(Map<String, dynamic> json) {
|
|
return LockerModel(
|
|
id: json['id'],
|
|
nomorLoker: json['nomor_loker'],
|
|
status: json['status'],
|
|
rfid: json['rfid'] ?? "",
|
|
);
|
|
}
|
|
}
|
|
|
|
class getLoker {
|
|
final String message;
|
|
final List<LockerModel> data;
|
|
|
|
getLoker({
|
|
required this.message,
|
|
required this.data,
|
|
});
|
|
|
|
factory getLoker.fromJson(Map<String, dynamic> json) {
|
|
return getLoker(
|
|
message: json['message'] ?? 'No message',
|
|
data: json['data'] != null
|
|
? (json['data'] as List).map((e) => LockerModel.fromJson(e)).toList()
|
|
: [],
|
|
);
|
|
}
|
|
}
|
|
|
|
class PenghasilanHarian {
|
|
final String tanggal;
|
|
final int totalPenghasilan;
|
|
final int jumlahTransaksi;
|
|
final List<DetailTransaksi> detail;
|
|
|
|
PenghasilanHarian({
|
|
required this.tanggal,
|
|
required this.totalPenghasilan,
|
|
required this.jumlahTransaksi,
|
|
required this.detail,
|
|
});
|
|
|
|
factory PenghasilanHarian.fromJson(Map<String, dynamic> json) {
|
|
return PenghasilanHarian(
|
|
tanggal: json['tanggal'],
|
|
totalPenghasilan: json['total_penghasilan'],
|
|
jumlahTransaksi: json['jumlah_transaksi'],
|
|
detail: (json['detail'] as List)
|
|
.map((item) => DetailTransaksi.fromJson(item))
|
|
.toList(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class DetailTransaksi {
|
|
final int id;
|
|
final int lokerId;
|
|
final int biaya;
|
|
|
|
DetailTransaksi({
|
|
required this.id,
|
|
required this.lokerId,
|
|
required this.biaya,
|
|
});
|
|
|
|
factory DetailTransaksi.fromJson(Map<String, dynamic> json) {
|
|
return DetailTransaksi(
|
|
id: json['id'],
|
|
lokerId: json['loker_id'],
|
|
biaya: json['biaya'],
|
|
);
|
|
}
|
|
}
|
|
|