Tambahkan dukungan penyimpanan lokal dan perbaikan manajemen data
- Integrasikan GetStorage untuk menyimpan data counter secara lokal - Tambahkan metode loadCountersFromStorage di CounterService - Perbarui model DonaturModel dan StokBantuanModel untuk konsistensi data - Tambahkan properti lastUpdateTime di controller untuk melacak pembaruan data - Perbaiki tampilan dengan menambahkan informasi waktu terakhir update - Optimalkan metode refresh dan update data di berbagai controller
This commit is contained in:
@ -5,10 +5,8 @@ class DonaturModel {
|
||||
final String? nama;
|
||||
final String? alamat;
|
||||
final String? telepon;
|
||||
final String? noHp;
|
||||
final String? email;
|
||||
final String? jenis;
|
||||
final String? deskripsi;
|
||||
final String? status;
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
@ -18,10 +16,8 @@ class DonaturModel {
|
||||
this.nama,
|
||||
this.alamat,
|
||||
this.telepon,
|
||||
this.noHp,
|
||||
this.email,
|
||||
this.jenis,
|
||||
this.deskripsi,
|
||||
this.status,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
@ -37,10 +33,8 @@ class DonaturModel {
|
||||
nama: json["nama"],
|
||||
alamat: json["alamat"],
|
||||
telepon: json["telepon"],
|
||||
noHp: json["no_hp"] ?? json["telepon"],
|
||||
email: json["email"],
|
||||
jenis: json["jenis"],
|
||||
deskripsi: json["deskripsi"],
|
||||
status: json["status"] ?? 'AKTIF',
|
||||
createdAt: json["created_at"] != null
|
||||
? DateTime.parse(json["created_at"])
|
||||
@ -55,10 +49,8 @@ class DonaturModel {
|
||||
"nama": nama,
|
||||
"alamat": alamat,
|
||||
"telepon": telepon,
|
||||
"no_hp": noHp ?? telepon,
|
||||
"email": email,
|
||||
"jenis": jenis,
|
||||
"deskripsi": deskripsi,
|
||||
"status": status ?? 'AKTIF',
|
||||
"created_at": createdAt?.toIso8601String(),
|
||||
"updated_at": updatedAt?.toIso8601String(),
|
||||
|
@ -36,7 +36,11 @@ class StokBantuanModel {
|
||||
nama: json["nama"],
|
||||
kategoriBantuanId: json["kategori_bantuan_id"],
|
||||
kategoriBantuan: json["kategori_bantuan"],
|
||||
totalStok: 0.0,
|
||||
totalStok: json["total_stok"] != null
|
||||
? (json["total_stok"] is int
|
||||
? json["total_stok"].toDouble()
|
||||
: json["total_stok"])
|
||||
: 0.0,
|
||||
satuan: json["satuan"],
|
||||
deskripsi: json["deskripsi"],
|
||||
createdAt: json["created_at"] != null
|
||||
@ -64,6 +68,11 @@ class StokBantuanModel {
|
||||
data["id"] = id;
|
||||
}
|
||||
|
||||
// Tambahkan total_stok hanya jika tidak null
|
||||
if (totalStok != null) {
|
||||
data["total_stok"] = totalStok;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user