Tambahkan dukungan image picker dan izin kamera untuk upload bukti serah terima
- Tambahkan paket image_picker untuk mengambil foto - Perbarui AndroidManifest.xml dan Info.plist untuk izin kamera dan galeri - Tambahkan metode pickfotoBuktiSerahTerima di PenitipanBantuanController - Buat dialog verifikasi dengan fitur upload foto bukti serah terima - Perbarui model PenitipanBantuanModel untuk mendukung foto bukti - Integrasikan upload file ke Supabase storage
This commit is contained in:
@ -38,7 +38,7 @@ class DonaturModel {
|
||||
email: json["email"],
|
||||
jenis: json["jenis"],
|
||||
deskripsi: json["deskripsi"],
|
||||
status: json["status"],
|
||||
status: json["status"] ?? 'AKTIF',
|
||||
createdAt: json["created_at"] != null
|
||||
? DateTime.parse(json["created_at"])
|
||||
: null,
|
||||
@ -55,7 +55,7 @@ class DonaturModel {
|
||||
"email": email,
|
||||
"jenis": jenis,
|
||||
"deskripsi": deskripsi,
|
||||
"status": status,
|
||||
"status": status ?? 'AKTIF',
|
||||
"created_at": createdAt?.toIso8601String(),
|
||||
"updated_at": updatedAt?.toIso8601String(),
|
||||
};
|
||||
|
47
lib/app/data/models/kategori_bantuan_model.dart
Normal file
47
lib/app/data/models/kategori_bantuan_model.dart
Normal file
@ -0,0 +1,47 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class KategoriBantuanModel {
|
||||
final String? id;
|
||||
final String? nama;
|
||||
final String? deskripsi;
|
||||
final String? satuan;
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
KategoriBantuanModel({
|
||||
this.id,
|
||||
this.nama,
|
||||
this.deskripsi,
|
||||
this.satuan,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
factory KategoriBantuanModel.fromRawJson(String str) =>
|
||||
KategoriBantuanModel.fromJson(json.decode(str));
|
||||
|
||||
String toRawJson() => json.encode(toJson());
|
||||
|
||||
factory KategoriBantuanModel.fromJson(Map<String, dynamic> json) =>
|
||||
KategoriBantuanModel(
|
||||
id: json["id"],
|
||||
nama: json["nama"],
|
||||
deskripsi: json["deskripsi"],
|
||||
satuan: json["satuan"],
|
||||
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() => {
|
||||
"id": id,
|
||||
"nama": nama,
|
||||
"deskripsi": deskripsi,
|
||||
"satuan": satuan,
|
||||
"created_at": createdAt?.toIso8601String(),
|
||||
"updated_at": updatedAt?.toIso8601String(),
|
||||
};
|
||||
}
|
@ -1,36 +1,46 @@
|
||||
import 'dart:convert';
|
||||
import 'package:penyaluran_app/app/data/models/donatur_model.dart';
|
||||
import 'package:penyaluran_app/app/data/models/kategori_bantuan_model.dart';
|
||||
|
||||
class PenitipanBantuanModel {
|
||||
final String? id;
|
||||
final String? donaturId;
|
||||
final String? bentukBantuanId;
|
||||
final String? nama;
|
||||
final String? stokBantuanId;
|
||||
final double? jumlah;
|
||||
final String? satuan;
|
||||
final String? deskripsi;
|
||||
final String? status;
|
||||
final String? alasanPenolakan;
|
||||
final List<String>? gambarUrls;
|
||||
final List<String>? fotoBantuan;
|
||||
final DateTime? tanggalPenitipan;
|
||||
final DateTime? tanggalVerifikasi;
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
final DateTime? tanggalKadaluarsa;
|
||||
final String? petugasDesaId;
|
||||
final String? fotoBuktiSerahTerima;
|
||||
final String? sumberBantuanId;
|
||||
final DonaturModel? donatur;
|
||||
final KategoriBantuanModel? kategoriBantuan;
|
||||
|
||||
PenitipanBantuanModel({
|
||||
this.id,
|
||||
this.donaturId,
|
||||
this.bentukBantuanId,
|
||||
this.nama,
|
||||
this.stokBantuanId,
|
||||
this.jumlah,
|
||||
this.satuan,
|
||||
this.deskripsi,
|
||||
this.status,
|
||||
this.alasanPenolakan,
|
||||
this.gambarUrls,
|
||||
this.fotoBantuan,
|
||||
this.tanggalPenitipan,
|
||||
this.tanggalVerifikasi,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.tanggalKadaluarsa,
|
||||
this.petugasDesaId,
|
||||
this.fotoBuktiSerahTerima,
|
||||
this.sumberBantuanId,
|
||||
this.donatur,
|
||||
this.kategoriBantuan,
|
||||
});
|
||||
|
||||
factory PenitipanBantuanModel.fromRawJson(String str) =>
|
||||
@ -42,16 +52,14 @@ class PenitipanBantuanModel {
|
||||
PenitipanBantuanModel(
|
||||
id: json["id"],
|
||||
donaturId: json["donatur_id"],
|
||||
bentukBantuanId: json["bentuk_bantuan_id"],
|
||||
nama: json["nama"],
|
||||
stokBantuanId: json["stok_bantuan_id"],
|
||||
jumlah: json["jumlah"] != null ? json["jumlah"].toDouble() : 0.0,
|
||||
satuan: json["satuan"],
|
||||
deskripsi: json["deskripsi"],
|
||||
status: json["status"],
|
||||
alasanPenolakan: json["alasan_penolakan"],
|
||||
gambarUrls: json["gambar_urls"] == null
|
||||
fotoBantuan: json["foto_bantuan"] == null
|
||||
? null
|
||||
: List<String>.from(json["gambar_urls"].map((x) => x)),
|
||||
: List<String>.from(json["foto_bantuan"].map((x) => x)),
|
||||
tanggalPenitipan: json["tanggal_penitipan"] != null
|
||||
? DateTime.parse(json["tanggal_penitipan"])
|
||||
: null,
|
||||
@ -64,24 +72,38 @@ class PenitipanBantuanModel {
|
||||
updatedAt: json["updated_at"] != null
|
||||
? DateTime.parse(json["updated_at"])
|
||||
: null,
|
||||
tanggalKadaluarsa: json["tanggal_kadaluarsa"] != null
|
||||
? DateTime.parse(json["tanggal_kadaluarsa"])
|
||||
: null,
|
||||
petugasDesaId: json["petugas_desa_id"],
|
||||
fotoBuktiSerahTerima: json["foto_bukti_serah_terima"],
|
||||
sumberBantuanId: json["sumber_bantuan_id"],
|
||||
donatur: json["donatur"] != null
|
||||
? DonaturModel.fromJson(json["donatur"])
|
||||
: null,
|
||||
kategoriBantuan: json["kategori_bantuan"] != null
|
||||
? KategoriBantuanModel.fromJson(json["kategori_bantuan"])
|
||||
: null,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"donatur_id": donaturId,
|
||||
"bentuk_bantuan_id": bentukBantuanId,
|
||||
"nama": nama,
|
||||
"stok_bantuan_id": stokBantuanId,
|
||||
"jumlah": jumlah,
|
||||
"satuan": satuan,
|
||||
"deskripsi": deskripsi,
|
||||
"status": status,
|
||||
"alasan_penolakan": alasanPenolakan,
|
||||
"gambar_urls": gambarUrls == null
|
||||
"foto_bantuan": fotoBantuan == null
|
||||
? null
|
||||
: List<dynamic>.from(gambarUrls!.map((x) => x)),
|
||||
: List<dynamic>.from(fotoBantuan!.map((x) => x)),
|
||||
"tanggal_penitipan": tanggalPenitipan?.toIso8601String(),
|
||||
"tanggal_verifikasi": tanggalVerifikasi?.toIso8601String(),
|
||||
"created_at": createdAt?.toIso8601String(),
|
||||
"updated_at": updatedAt?.toIso8601String(),
|
||||
"tanggal_kadaluarsa": tanggalKadaluarsa?.toIso8601String(),
|
||||
"petugas_desa_id": petugasDesaId,
|
||||
"foto_bukti_serah_terima": fotoBuktiSerahTerima,
|
||||
"sumber_bantuan_id": sumberBantuanId,
|
||||
};
|
||||
}
|
||||
|
@ -1,33 +1,25 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class PetugasDesaModel {
|
||||
final String id;
|
||||
final String nama;
|
||||
final String? alamat;
|
||||
final String? id;
|
||||
final String? nama;
|
||||
final String? alamatLengkap;
|
||||
final String? noTelp;
|
||||
final String? email;
|
||||
final String? jabatan;
|
||||
final String? desa;
|
||||
final String? kecamatan;
|
||||
final String? kabupaten;
|
||||
final String? provinsi;
|
||||
final String? userId; // Referensi ke User jika petugas memiliki akun
|
||||
final DateTime createdAt;
|
||||
final String? userId;
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
PetugasDesaModel({
|
||||
required this.id,
|
||||
required this.nama,
|
||||
this.alamat,
|
||||
this.id,
|
||||
this.nama,
|
||||
this.alamatLengkap,
|
||||
this.noTelp,
|
||||
this.email,
|
||||
this.jabatan,
|
||||
this.desa,
|
||||
this.kecamatan,
|
||||
this.kabupaten,
|
||||
this.provinsi,
|
||||
this.userId,
|
||||
required this.createdAt,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
@ -40,34 +32,28 @@ class PetugasDesaModel {
|
||||
PetugasDesaModel(
|
||||
id: json["id"],
|
||||
nama: json["nama"],
|
||||
alamat: json["alamat"],
|
||||
alamatLengkap: json["alamat_lengkap"],
|
||||
noTelp: json["no_telp"],
|
||||
email: json["email"],
|
||||
jabatan: json["jabatan"],
|
||||
desa: json["desa"],
|
||||
kecamatan: json["kecamatan"],
|
||||
kabupaten: json["kabupaten"],
|
||||
provinsi: json["provinsi"],
|
||||
userId: json["user_id"],
|
||||
createdAt: DateTime.parse(json["created_at"]),
|
||||
updatedAt: json["updated_at"] == null
|
||||
? null
|
||||
: DateTime.parse(json["updated_at"]),
|
||||
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() => {
|
||||
"id": id,
|
||||
"nama": nama,
|
||||
"alamat": alamat,
|
||||
"alamat_lengkap": alamatLengkap,
|
||||
"no_telp": noTelp,
|
||||
"email": email,
|
||||
"jabatan": jabatan,
|
||||
"desa": desa,
|
||||
"kecamatan": kecamatan,
|
||||
"kabupaten": kabupaten,
|
||||
"provinsi": provinsi,
|
||||
"user_id": userId,
|
||||
"created_at": createdAt.toIso8601String(),
|
||||
"created_at": createdAt?.toIso8601String(),
|
||||
"updated_at": updatedAt?.toIso8601String(),
|
||||
};
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ class StokBantuanModel {
|
||||
final String? nama;
|
||||
final String? kategoriBantuanId;
|
||||
final Map<String, dynamic>? kategoriBantuan;
|
||||
final double? jumlah;
|
||||
final double? totalStok;
|
||||
final String? satuan;
|
||||
final String? deskripsi;
|
||||
final DateTime? tanggalMasuk;
|
||||
@ -18,7 +18,7 @@ class StokBantuanModel {
|
||||
this.nama,
|
||||
this.kategoriBantuanId,
|
||||
this.kategoriBantuan,
|
||||
this.jumlah,
|
||||
this.totalStok,
|
||||
this.satuan,
|
||||
this.deskripsi,
|
||||
this.tanggalMasuk,
|
||||
@ -38,7 +38,8 @@ class StokBantuanModel {
|
||||
nama: json["nama"],
|
||||
kategoriBantuanId: json["kategori_bantuan_id"],
|
||||
kategoriBantuan: json["kategori_bantuan"],
|
||||
jumlah: json["jumlah"] != null ? json["jumlah"].toDouble() : 0.0,
|
||||
totalStok:
|
||||
json["total_stok"] != null ? json["total_stok"].toDouble() : 0.0,
|
||||
satuan: json["satuan"],
|
||||
deskripsi: json["deskripsi"],
|
||||
tanggalMasuk: json["tanggal_masuk"] != null
|
||||
@ -59,7 +60,7 @@ class StokBantuanModel {
|
||||
final Map<String, dynamic> data = {
|
||||
"nama": nama,
|
||||
"kategori_bantuan_id": kategoriBantuanId,
|
||||
"jumlah": jumlah,
|
||||
"total_stok": totalStok,
|
||||
"satuan": satuan,
|
||||
"deskripsi": deskripsi,
|
||||
"tanggal_masuk": tanggalMasuk?.toIso8601String(),
|
||||
|
@ -1,19 +1,17 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class SumberBantuanModel {
|
||||
final String id;
|
||||
final String nama;
|
||||
final String? id;
|
||||
final String? nama;
|
||||
final String? deskripsi;
|
||||
final String? kategori; // Contoh: 'pemerintah', 'swasta', 'masyarakat'
|
||||
final DateTime createdAt;
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
SumberBantuanModel({
|
||||
required this.id,
|
||||
required this.nama,
|
||||
this.id,
|
||||
this.nama,
|
||||
this.deskripsi,
|
||||
this.kategori,
|
||||
required this.createdAt,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
@ -27,19 +25,19 @@ class SumberBantuanModel {
|
||||
id: json["id"],
|
||||
nama: json["nama"],
|
||||
deskripsi: json["deskripsi"],
|
||||
kategori: json["kategori"],
|
||||
createdAt: DateTime.parse(json["created_at"]),
|
||||
updatedAt: json["updated_at"] == null
|
||||
? null
|
||||
: DateTime.parse(json["updated_at"]),
|
||||
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() => {
|
||||
"id": id,
|
||||
"nama": nama,
|
||||
"deskripsi": deskripsi,
|
||||
"kategori": kategori,
|
||||
"created_at": createdAt.toIso8601String(),
|
||||
"created_at": createdAt?.toIso8601String(),
|
||||
"updated_at": updatedAt?.toIso8601String(),
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user