h-1 lebaran
This commit is contained in:
@ -12,6 +12,7 @@ class LokasiPenyaluranModel {
|
||||
final double? latitude;
|
||||
final double? longitude;
|
||||
final String? petugasDesaId; // Referensi ke PetugasDesa
|
||||
final bool isLokasiTitip; // Field baru untuk menentukan lokasi penitipan
|
||||
final DateTime createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
@ -27,6 +28,7 @@ class LokasiPenyaluranModel {
|
||||
this.latitude,
|
||||
this.longitude,
|
||||
this.petugasDesaId,
|
||||
this.isLokasiTitip = false, // Nilai default false
|
||||
required this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
@ -49,6 +51,7 @@ class LokasiPenyaluranModel {
|
||||
latitude: json["latitude"]?.toDouble(),
|
||||
longitude: json["longitude"]?.toDouble(),
|
||||
petugasDesaId: json["petugas_desa_id"],
|
||||
isLokasiTitip: json["is_lokasi_titip"] ?? false,
|
||||
createdAt: DateTime.parse(json["created_at"]),
|
||||
updatedAt: json["updated_at"] == null
|
||||
? null
|
||||
@ -67,6 +70,7 @@ class LokasiPenyaluranModel {
|
||||
"latitude": latitude,
|
||||
"longitude": longitude,
|
||||
"petugas_desa_id": petugasDesaId,
|
||||
"is_lokasi_titip": isLokasiTitip,
|
||||
"created_at": createdAt.toIso8601String(),
|
||||
"updated_at": updatedAt?.toIso8601String(),
|
||||
};
|
||||
|
@ -71,6 +71,14 @@ class PenyaluranBantuanModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Mendapatkan foto petugas dari relasi petugas
|
||||
String? get fotoPetugas {
|
||||
if (petugas != null && petugas!['foto_profil'] != null) {
|
||||
return petugas!['foto_profil'];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
factory PenyaluranBantuanModel.fromRawJson(String str) =>
|
||||
PenyaluranBantuanModel.fromJson(json.decode(str));
|
||||
|
||||
@ -126,4 +134,49 @@ class PenyaluranBantuanModel {
|
||||
"created_at": createdAt?.toUtc().toIso8601String(),
|
||||
"updated_at": updatedAt?.toUtc().toIso8601String(),
|
||||
};
|
||||
|
||||
// Metode copyWith untuk membuat salinan objek dengan perubahan tertentu
|
||||
PenyaluranBantuanModel copyWith({
|
||||
String? id,
|
||||
String? nama,
|
||||
String? deskripsi,
|
||||
String? petugasId,
|
||||
String? skemaId,
|
||||
String? lokasiPenyaluranId,
|
||||
String? kategoriBantuanId,
|
||||
int? jumlahPenerima,
|
||||
DateTime? tanggalPenyaluran,
|
||||
String? status,
|
||||
String? alasanPembatalan,
|
||||
DateTime? tanggalPembatalan,
|
||||
DateTime? tanggalSelesai,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
Map<String, dynamic>? lokasiPenyaluran,
|
||||
Map<String, dynamic>? kategori,
|
||||
Map<String, dynamic>? petugas,
|
||||
int? jumlahBantuan,
|
||||
}) {
|
||||
return PenyaluranBantuanModel(
|
||||
id: id ?? this.id,
|
||||
nama: nama ?? this.nama,
|
||||
deskripsi: deskripsi ?? this.deskripsi,
|
||||
petugasId: petugasId ?? this.petugasId,
|
||||
skemaId: skemaId ?? this.skemaId,
|
||||
lokasiPenyaluranId: lokasiPenyaluranId ?? this.lokasiPenyaluranId,
|
||||
kategoriBantuanId: kategoriBantuanId ?? this.kategoriBantuanId,
|
||||
jumlahPenerima: jumlahPenerima ?? this.jumlahPenerima,
|
||||
tanggalPenyaluran: tanggalPenyaluran ?? this.tanggalPenyaluran,
|
||||
status: status ?? this.status,
|
||||
alasanPembatalan: alasanPembatalan ?? this.alasanPembatalan,
|
||||
tanggalPembatalan: tanggalPembatalan ?? this.tanggalPembatalan,
|
||||
tanggalSelesai: tanggalSelesai ?? this.tanggalSelesai,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
updatedAt: updatedAt ?? this.updatedAt,
|
||||
lokasiPenyaluran: lokasiPenyaluran ?? this.lokasiPenyaluran,
|
||||
kategori: kategori ?? this.kategori,
|
||||
petugas: petugas ?? this.petugas,
|
||||
jumlahBantuan: jumlahBantuan ?? this.jumlahBantuan,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user