ambil data stok bantuan
This commit is contained in:
@ -1,34 +1,34 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class LaporanModel {
|
||||
final String id;
|
||||
final String judul;
|
||||
final String? id;
|
||||
final String? judul;
|
||||
final String? deskripsi;
|
||||
final String jenis; // Contoh: 'penyaluran', 'penitipan', 'pengaduan'
|
||||
final String? jenis; // Contoh: 'PENYALURAN', 'STOK_BANTUAN', 'PENERIMA'
|
||||
final String?
|
||||
referensiId; // ID dari entitas yang dilaporkan (penyaluran, penitipan, dll)
|
||||
final String status; // Contoh: 'draft', 'final', 'disetujui'
|
||||
final String? userId; // Pengguna yang membuat laporan
|
||||
final String? status; // Contoh: 'draft', 'final', 'disetujui'
|
||||
final String? petugasId; // Pengguna yang membuat laporan
|
||||
final List<String>? fileUrls; // URL file laporan (PDF, Excel, dll)
|
||||
final DateTime periodeAwal;
|
||||
final DateTime periodeAkhir;
|
||||
final DateTime tanggalLaporan;
|
||||
final DateTime createdAt;
|
||||
final DateTime? tanggalMulai;
|
||||
final DateTime? tanggalSelesai;
|
||||
final DateTime? tanggalLaporan;
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
LaporanModel({
|
||||
required this.id,
|
||||
required this.judul,
|
||||
this.id,
|
||||
this.judul,
|
||||
this.deskripsi,
|
||||
required this.jenis,
|
||||
this.jenis,
|
||||
this.referensiId,
|
||||
required this.status,
|
||||
this.userId,
|
||||
this.status,
|
||||
this.petugasId,
|
||||
this.fileUrls,
|
||||
required this.periodeAwal,
|
||||
required this.periodeAkhir,
|
||||
required this.tanggalLaporan,
|
||||
required this.createdAt,
|
||||
this.tanggalMulai,
|
||||
this.tanggalSelesai,
|
||||
this.tanggalLaporan,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
@ -44,17 +44,29 @@ class LaporanModel {
|
||||
jenis: json["jenis"],
|
||||
referensiId: json["referensi_id"],
|
||||
status: json["status"],
|
||||
userId: json["user_id"],
|
||||
petugasId: json["petugas_id"] ?? json["user_id"],
|
||||
fileUrls: json["file_urls"] == null
|
||||
? null
|
||||
: List<String>.from(json["file_urls"].map((x) => x)),
|
||||
periodeAwal: DateTime.parse(json["periode_awal"]),
|
||||
periodeAkhir: DateTime.parse(json["periode_akhir"]),
|
||||
tanggalLaporan: DateTime.parse(json["tanggal_laporan"]),
|
||||
createdAt: DateTime.parse(json["created_at"]),
|
||||
updatedAt: json["updated_at"] == null
|
||||
? null
|
||||
: DateTime.parse(json["updated_at"]),
|
||||
tanggalMulai: json["tanggal_mulai"] != null
|
||||
? DateTime.parse(json["tanggal_mulai"])
|
||||
: json["periode_awal"] != null
|
||||
? DateTime.parse(json["periode_awal"])
|
||||
: null,
|
||||
tanggalSelesai: json["tanggal_selesai"] != null
|
||||
? DateTime.parse(json["tanggal_selesai"])
|
||||
: json["periode_akhir"] != null
|
||||
? DateTime.parse(json["periode_akhir"])
|
||||
: null,
|
||||
tanggalLaporan: json["tanggal_laporan"] != null
|
||||
? DateTime.parse(json["tanggal_laporan"])
|
||||
: null,
|
||||
createdAt: json["created_at"] != null
|
||||
? DateTime.parse(json["created_at"])
|
||||
: null,
|
||||
updatedAt: json["updated_at"] != null
|
||||
? DateTime.parse(json["updated_at"])
|
||||
: null,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
@ -64,14 +76,14 @@ class LaporanModel {
|
||||
"jenis": jenis,
|
||||
"referensi_id": referensiId,
|
||||
"status": status,
|
||||
"user_id": userId,
|
||||
"petugas_id": petugasId,
|
||||
"file_urls": fileUrls == null
|
||||
? null
|
||||
: List<dynamic>.from(fileUrls!.map((x) => x)),
|
||||
"periode_awal": periodeAwal.toIso8601String(),
|
||||
"periode_akhir": periodeAkhir.toIso8601String(),
|
||||
"tanggal_laporan": tanggalLaporan.toIso8601String(),
|
||||
"created_at": createdAt.toIso8601String(),
|
||||
"tanggal_mulai": tanggalMulai?.toIso8601String(),
|
||||
"tanggal_selesai": tanggalSelesai?.toIso8601String(),
|
||||
"tanggal_laporan": tanggalLaporan?.toIso8601String(),
|
||||
"created_at": createdAt?.toIso8601String(),
|
||||
"updated_at": updatedAt?.toIso8601String(),
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user