Hapus fungsi dan logika yang tidak digunakan di CalendarViewWidget, termasuk pengambilan dan penampilan jadwal penyaluran pada hari tertentu. Perbarui tampilan di DaftarDonaturView dan DonaturSearchDelegate untuk menyederhanakan penghitungan donasi. Modifikasi PenitipanView dengan menghapus fungsi tampilan gambar penuh yang tidak digunakan. Perbarui DetailPenitipanDialog untuk menghilangkan nilai default pada nama petugas desa.
This commit is contained in:
@ -113,8 +113,6 @@ class CalendarViewWidget extends StatelessWidget {
|
|||||||
_showAppointmentDetails(context, appointment);
|
_showAppointmentDetails(context, appointment);
|
||||||
} else if (details.targetElement ==
|
} else if (details.targetElement ==
|
||||||
CalendarElement.calendarCell) {
|
CalendarElement.calendarCell) {
|
||||||
final List<Appointment> appointmentsOnDay =
|
|
||||||
_getAppointmentsOnDay(details.date!);
|
|
||||||
// if (appointmentsOnDay.isNotEmpty) {
|
// if (appointmentsOnDay.isNotEmpty) {
|
||||||
// _showAppointmentsOnDay(
|
// _showAppointmentsOnDay(
|
||||||
// context, details.date!, appointmentsOnDay);
|
// context, details.date!, appointmentsOnDay);
|
||||||
@ -294,126 +292,6 @@ class CalendarViewWidget extends StatelessWidget {
|
|||||||
return _AppointmentDataSource(appointments);
|
return _AppointmentDataSource(appointments);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Appointment> _getAppointmentsOnDay(DateTime date) {
|
|
||||||
final List<Appointment> appointments = [];
|
|
||||||
final _AppointmentDataSource dataSource = _getCalendarDataSource();
|
|
||||||
|
|
||||||
for (final appointment in dataSource.appointments!) {
|
|
||||||
final Appointment app = appointment as Appointment;
|
|
||||||
if (app.startTime.year == date.year &&
|
|
||||||
app.startTime.month == date.month &&
|
|
||||||
app.startTime.day == date.day) {
|
|
||||||
appointments.add(app);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return appointments;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _showAppointmentsOnDay(
|
|
||||||
BuildContext context, DateTime date, List<Appointment> appointments) {
|
|
||||||
final String formattedDate = DateTimeHelper.formatDateIndonesian(date);
|
|
||||||
|
|
||||||
showModalBottomSheet(
|
|
||||||
context: context,
|
|
||||||
isScrollControlled: true,
|
|
||||||
shape: const RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
|
||||||
),
|
|
||||||
builder: (context) => Container(
|
|
||||||
padding: const EdgeInsets.all(20),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'Jadwal Penyaluran $formattedDate',
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
if (appointments.isEmpty)
|
|
||||||
const Text('Tidak ada jadwal penyaluran pada tanggal ini.')
|
|
||||||
else
|
|
||||||
ListView.builder(
|
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
itemCount: appointments.length,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
final appointment = appointments[index];
|
|
||||||
return Card(
|
|
||||||
margin: const EdgeInsets.only(bottom: 10),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
),
|
|
||||||
child: ListTile(
|
|
||||||
contentPadding: const EdgeInsets.all(12),
|
|
||||||
leading: Container(
|
|
||||||
width: 12,
|
|
||||||
height: double.infinity,
|
|
||||||
color: appointment.color,
|
|
||||||
),
|
|
||||||
title: Text(
|
|
||||||
appointment.subject,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
subtitle: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
const SizedBox(height: 4),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
const Icon(Icons.access_time, size: 14),
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
Text(
|
|
||||||
'${appointment.startTime.hour}:${appointment.startTime.minute.toString().padLeft(2, '0')} - ${appointment.endTime.hour}:${appointment.endTime.minute.toString().padLeft(2, '0')} WIB',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 4),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
const Icon(Icons.location_on, size: 14),
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
Expanded(
|
|
||||||
child: Text(appointment.location ?? ''),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onTap: () => Get.toNamed('/pelaksanaan-penyaluran',
|
|
||||||
arguments: appointment),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
SizedBox(
|
|
||||||
width: double.infinity,
|
|
||||||
child: ElevatedButton(
|
|
||||||
onPressed: () => Navigator.pop(context),
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor: AppTheme.primaryColor,
|
|
||||||
foregroundColor: Colors.white,
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: const Text('Tutup'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _showAppointmentDetails(BuildContext context, Appointment appointment) {
|
void _showAppointmentDetails(BuildContext context, Appointment appointment) {
|
||||||
final String formattedDate =
|
final String formattedDate =
|
||||||
DateTimeHelper.formatDateIndonesian(appointment.startTime);
|
DateTimeHelper.formatDateIndonesian(appointment.startTime);
|
||||||
@ -511,10 +389,6 @@ class CalendarViewWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String _formatDateIndonesian(DateTime date) {
|
|
||||||
return DateTimeHelper.formatDateIndonesian(date);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AppointmentDataSource extends CalendarDataSource {
|
class _AppointmentDataSource extends CalendarDataSource {
|
||||||
|
@ -185,12 +185,8 @@ class DaftarDonaturView extends GetView<DonaturController> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Hitung jumlah donasi dan total nilai donasi
|
// Hitung jumlah donasi dan total nilai donasi
|
||||||
final jumlahDonasi = controller.getJumlahDonasi(donatur.id);
|
|
||||||
final jumlahDonasiUang = controller.getJumlahDonasiUang(donatur.id);
|
final jumlahDonasiUang = controller.getJumlahDonasiUang(donatur.id);
|
||||||
final jumlahDonasiBarang = controller.getJumlahDonasiBarang(donatur.id);
|
final jumlahDonasiBarang = controller.getJumlahDonasiBarang(donatur.id);
|
||||||
final totalNilaiDonasiUang = controller.getTotalNilaiDonasiUang(donatur.id);
|
|
||||||
final totalNilaiDonasiUangFormatted =
|
|
||||||
controller.formatRupiah(totalNilaiDonasiUang);
|
|
||||||
|
|
||||||
return Card(
|
return Card(
|
||||||
margin: const EdgeInsets.only(bottom: 16),
|
margin: const EdgeInsets.only(bottom: 16),
|
||||||
@ -431,8 +427,6 @@ class DonaturSearchDelegate extends SearchDelegate {
|
|||||||
|
|
||||||
// Hitung jumlah donasi dan total nilai donasi
|
// Hitung jumlah donasi dan total nilai donasi
|
||||||
final jumlahDonasi = controller.getJumlahDonasi(donatur.id);
|
final jumlahDonasi = controller.getJumlahDonasi(donatur.id);
|
||||||
final jumlahDonasiUang = controller.getJumlahDonasiUang(donatur.id);
|
|
||||||
final jumlahDonasiBarang = controller.getJumlahDonasiBarang(donatur.id);
|
|
||||||
final totalNilaiDonasiUang =
|
final totalNilaiDonasiUang =
|
||||||
controller.getTotalNilaiDonasiUang(donatur.id);
|
controller.getTotalNilaiDonasiUang(donatur.id);
|
||||||
final totalNilaiDonasiUangFormatted =
|
final totalNilaiDonasiUangFormatted =
|
||||||
|
@ -702,89 +702,13 @@ class PenitipanView extends GetView<PenitipanBantuanController> {
|
|||||||
donaturNama: donaturNama,
|
donaturNama: donaturNama,
|
||||||
kategoriNama: kategoriNama,
|
kategoriNama: kategoriNama,
|
||||||
kategoriSatuan: kategoriSatuan,
|
kategoriSatuan: kategoriSatuan,
|
||||||
getPetugasDesaNama: (String? id) =>
|
getPetugasDesaNama: (String? id) => controller.getPetugasDesaNama(id),
|
||||||
controller.getPetugasDesaNama(id) ?? 'Tidak diketahui',
|
|
||||||
showFullScreenImage: (String imageUrl) {
|
showFullScreenImage: (String imageUrl) {
|
||||||
DetailPenitipanDialog.showFullScreenImage(context, imageUrl);
|
DetailPenitipanDialog.showFullScreenImage(context, imageUrl);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showFullScreenImage(BuildContext context, String imageUrl) {
|
|
||||||
Get.dialog(
|
|
||||||
Dialog(
|
|
||||||
insetPadding: EdgeInsets.zero,
|
|
||||||
child: Stack(
|
|
||||||
fit: StackFit.expand,
|
|
||||||
children: [
|
|
||||||
InteractiveViewer(
|
|
||||||
panEnabled: true,
|
|
||||||
minScale: 0.5,
|
|
||||||
maxScale: 4,
|
|
||||||
child: Image.network(
|
|
||||||
imageUrl,
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
errorBuilder: (context, error, stackTrace) {
|
|
||||||
return Container(
|
|
||||||
color: Colors.grey.shade300,
|
|
||||||
child: const Center(
|
|
||||||
child: Icon(
|
|
||||||
Icons.error,
|
|
||||||
size: 50,
|
|
||||||
color: Colors.red,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
top: 20,
|
|
||||||
right: 20,
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () => Get.back(),
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.all(8),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.black.withOpacity(0.5),
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
child: const Icon(
|
|
||||||
Icons.close,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildDetailItem(String label, String value) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 8.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
label,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: 14,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
value,
|
|
||||||
style: const TextStyle(fontSize: 14),
|
|
||||||
),
|
|
||||||
const Divider(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildItemDetail(
|
Widget _buildItemDetail(
|
||||||
BuildContext context, {
|
BuildContext context, {
|
||||||
required IconData icon,
|
required IconData icon,
|
||||||
|
@ -72,7 +72,7 @@ class DetailPenitipanDialog {
|
|||||||
if (item.status == 'TERVERIFIKASI' && item.petugasDesaId != null)
|
if (item.status == 'TERVERIFIKASI' && item.petugasDesaId != null)
|
||||||
_buildDetailItem(
|
_buildDetailItem(
|
||||||
'Diverifikasi Oleh',
|
'Diverifikasi Oleh',
|
||||||
getPetugasDesaNama(item.petugasDesaId) ?? 'Tidak diketahui',
|
getPetugasDesaNama(item.petugasDesaId),
|
||||||
),
|
),
|
||||||
_buildDetailItem('Tanggal Dibuat',
|
_buildDetailItem('Tanggal Dibuat',
|
||||||
DateFormatter.formatDateTime(item.createdAt)),
|
DateFormatter.formatDateTime(item.createdAt)),
|
||||||
|
Reference in New Issue
Block a user