membuat tampilan lebih menarik

This commit is contained in:
Khafidh Fuadi
2025-03-27 22:31:14 +07:00
parent f6d3eef2cf
commit c008020705
44 changed files with 6260 additions and 3195 deletions

View File

@ -4,7 +4,7 @@ import 'package:syncfusion_flutter_calendar/calendar.dart';
import 'package:penyaluran_app/app/data/models/penyaluran_bantuan_model.dart';
import 'package:penyaluran_app/app/modules/petugas_desa/controllers/jadwal_penyaluran_controller.dart';
import 'package:penyaluran_app/app/theme/app_theme.dart';
import 'package:penyaluran_app/app/utils/date_time_helper.dart';
import 'package:penyaluran_app/app/utils/format_helper.dart';
class CalendarViewWidget extends StatelessWidget {
final JadwalPenyaluranController controller;
@ -25,30 +25,48 @@ class CalendarViewWidget extends StatelessWidget {
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.1),
spreadRadius: 1,
blurRadius: 3,
offset: const Offset(0, 1),
blurRadius: 5,
offset: const Offset(0, 2),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
Container(
padding: const EdgeInsets.all(16.0),
child: Text(
'Kalender Penyaluran Bulan Ini',
style: Theme.of(context).textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.bold,
),
decoration: BoxDecoration(
gradient: AppTheme.primaryGradient,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(16),
topRight: Radius.circular(16),
),
),
child: Row(
children: [
const Icon(
Icons.calendar_month_rounded,
color: Colors.white,
size: 28,
),
const SizedBox(width: 12),
Text(
'Kalender Penyaluran',
style: Theme.of(context).textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
],
),
),
Padding(
padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.all(12.0),
child: SizedBox(
height: MediaQuery.of(context).size.height * 0.65,
child: Obx(() {
@ -64,7 +82,7 @@ class CalendarViewWidget extends StatelessWidget {
MonthAppointmentDisplayMode.indicator,
showAgenda: true,
agendaViewHeight: MediaQuery.of(context).size.height * 0.3,
agendaItemHeight: 60,
agendaItemHeight: 70,
dayFormat: 'EEE',
numberOfWeeksInView: 6,
appointmentDisplayCount: 3,
@ -82,19 +100,19 @@ class CalendarViewWidget extends StatelessWidget {
color: Colors.grey.withOpacity(0.7),
),
),
agendaStyle: const AgendaStyle(
backgroundColor: Colors.white,
appointmentTextStyle: TextStyle(
agendaStyle: AgendaStyle(
backgroundColor: Colors.grey.shade50,
appointmentTextStyle: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.white,
),
dateTextStyle: TextStyle(
dateTextStyle: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
fontWeight: FontWeight.w600,
color: AppTheme.primaryColor,
),
dayTextStyle: TextStyle(
dayTextStyle: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: AppTheme.primaryColor,
@ -106,7 +124,7 @@ class CalendarViewWidget extends StatelessWidget {
selectionDecoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(color: AppTheme.primaryColor, width: 2),
borderRadius: const BorderRadius.all(Radius.circular(4)),
borderRadius: const BorderRadius.all(Radius.circular(8)),
shape: BoxShape.rectangle,
),
headerStyle: const CalendarHeaderStyle(
@ -163,6 +181,13 @@ class CalendarViewWidget extends StatelessWidget {
? BoxDecoration(
shape: BoxShape.circle,
color: AppTheme.primaryColor,
boxShadow: [
BoxShadow(
color: AppTheme.primaryColor.withOpacity(0.3),
blurRadius: 4,
offset: const Offset(0, 2),
)
],
)
: null,
child: Column(
@ -179,7 +204,7 @@ class CalendarViewWidget extends StatelessWidget {
details.date.year == DateTime.now().year
? Colors.white
: AppTheme.primaryColor,
fontWeight: FontWeight.w500,
fontWeight: FontWeight.w600,
),
),
),
@ -201,12 +226,19 @@ class CalendarViewWidget extends StatelessWidget {
),
if (hasAppointments && details.appointments.isEmpty)
Container(
width: 6,
height: 6,
width: 8,
height: 8,
margin: const EdgeInsets.only(bottom: 2),
decoration: const BoxDecoration(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppTheme.primaryColor,
boxShadow: [
BoxShadow(
color: AppTheme.primaryColor.withOpacity(0.3),
blurRadius: 2,
spreadRadius: 0.5,
)
],
),
),
],
@ -322,131 +354,245 @@ class CalendarViewWidget extends StatelessWidget {
showModalBottomSheet(
context: context,
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
),
backgroundColor: Colors.transparent,
builder: (context) => Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: Container(
padding: const EdgeInsets.all(20),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 24),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
boxShadow: [
BoxShadow(
color: Colors.black26,
blurRadius: 10,
spreadRadius: 0,
offset: Offset(0, -2),
),
],
),
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height * 0.7,
),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: Text(
appointment.subject,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Handle bar
Center(
child: Container(
width: 40,
height: 5,
margin: const EdgeInsets.only(bottom: 20),
decoration: BoxDecoration(
color: Colors.grey.shade300,
borderRadius: BorderRadius.circular(30),
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
appointment.subject,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
if (status != null) _buildStatusBadge(status),
],
),
const SizedBox(width: 8),
if (status != null) _buildStatusBadge(status),
],
),
const SizedBox(height: 16),
// Date, time and location info
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.grey.shade50,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: Colors.grey.shade200),
),
const SizedBox(height: 10),
if (status != null) ...[
Row(
children: [
Icon(
_getStatusIcon(status),
size: 16,
color: _getStatusColor(status),
),
const SizedBox(width: 8),
Text(
'Status: ${_getStatusText(status)}',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: _getStatusColor(status),
child: Column(
children: [
Row(
children: [
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: AppTheme.primaryColor.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
),
child: const Icon(
Icons.calendar_today,
size: 16,
color: AppTheme.primaryColor,
),
),
const SizedBox(width: 12),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Tanggal',
style: TextStyle(
fontSize: 12,
color: Colors.grey.shade600,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 2),
Text(
formattedDate,
style: const TextStyle(
fontSize: 14, fontWeight: FontWeight.w600),
),
],
),
],
),
const SizedBox(height: 12),
Row(
children: [
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: AppTheme.primaryColor.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
),
child: const Icon(
Icons.access_time,
size: 16,
color: AppTheme.primaryColor,
),
),
const SizedBox(width: 12),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Waktu',
style: TextStyle(
fontSize: 12,
color: Colors.grey.shade600,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 2),
Text(
'${appointment.startTime.hour}:${appointment.startTime.minute.toString().padLeft(2, '0')} - ${appointment.endTime.hour}:${appointment.endTime.minute.toString().padLeft(2, '0')} WIB',
style: const TextStyle(
fontSize: 14, fontWeight: FontWeight.w600),
),
],
),
],
),
if (appointment.location != null &&
appointment.location!.isNotEmpty) ...[
const SizedBox(height: 12),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: AppTheme.primaryColor.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
),
child: const Icon(
Icons.location_on,
size: 16,
color: AppTheme.primaryColor,
),
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Lokasi',
style: TextStyle(
fontSize: 12,
color: Colors.grey.shade600,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 2),
Text(
appointment.location!,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600),
),
],
),
),
],
),
],
),
const SizedBox(height: 8),
],
Row(
children: [
const Icon(Icons.calendar_today, size: 16),
const SizedBox(width: 8),
Text(
formattedDate,
style: const TextStyle(fontSize: 16),
),
],
),
),
if (appointment.notes != null &&
appointment.notes!.isNotEmpty) ...[
const SizedBox(height: 20),
Text(
'Deskripsi',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.grey.shade800,
),
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.access_time, size: 16),
const SizedBox(width: 8),
Text(
'${appointment.startTime.hour}:${appointment.startTime.minute.toString().padLeft(2, '0')} - ${appointment.endTime.hour}:${appointment.endTime.minute.toString().padLeft(2, '0')} WIB',
style: const TextStyle(fontSize: 16),
),
],
),
if (appointment.location != null &&
appointment.location!.isNotEmpty) ...[
const SizedBox(height: 8),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Icon(Icons.location_on, size: 16),
const SizedBox(width: 8),
Expanded(
child: Text(
appointment.location!,
style: const TextStyle(fontSize: 16),
),
),
],
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.grey.shade50,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: Colors.grey.shade200),
),
],
if (appointment.notes != null &&
appointment.notes!.isNotEmpty) ...[
const SizedBox(height: 16),
const Text(
'Deskripsi:',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 8),
Text(
child: Text(
appointment.notes!,
style: const TextStyle(fontSize: 16),
),
],
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),
),
style: TextStyle(
fontSize: 14,
color: Colors.grey.shade800,
height: 1.5,
),
child: const Text('Tutup'),
),
),
],
),
const SizedBox(height: 24),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: () => Navigator.pop(context),
style: ElevatedButton.styleFrom(
backgroundColor: AppTheme.primaryColor,
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 14),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
elevation: 0,
),
child: const Text(
'Tutup',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
),
),
],
),
),
),

View File

@ -3,7 +3,7 @@ import 'package:get/get.dart';
import 'package:penyaluran_app/app/data/models/penyaluran_bantuan_model.dart';
import 'package:penyaluran_app/app/modules/petugas_desa/controllers/jadwal_penyaluran_controller.dart';
import 'package:penyaluran_app/app/routes/app_pages.dart';
import 'package:penyaluran_app/app/utils/date_time_helper.dart';
import 'package:penyaluran_app/app/utils/format_helper.dart';
import 'package:penyaluran_app/app/theme/app_theme.dart';
class JadwalSectionWidget extends StatelessWidget {
@ -43,32 +43,56 @@ class JadwalSectionWidget extends StatelessWidget {
),
],
),
const SizedBox(height: 12),
const SizedBox(height: 16),
Obx(() {
final currentJadwalList = _getCurrentJadwalList();
if (currentJadwalList.isEmpty) {
return Container(
padding: const EdgeInsets.all(16),
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
color: Colors.grey.withAlpha(20),
borderRadius: BorderRadius.circular(12),
color: Colors.grey.shade50,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: Colors.grey.shade200),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.03),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
),
child: Center(
child: Column(
children: [
Icon(
_getEmptyIcon(),
size: 40,
color: Colors.grey.shade400,
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.grey.shade100,
shape: BoxShape.circle,
),
child: Icon(
_getEmptyIcon(),
size: 48,
color: Colors.grey.shade400,
),
),
const SizedBox(height: 8),
const SizedBox(height: 16),
Text(
'Tidak ada jadwal $title',
style: textTheme.titleMedium?.copyWith(
color: Colors.grey.shade600,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 8),
Text(
'Jadwal akan muncul di sini saat tersedia',
style: textTheme.bodySmall?.copyWith(
color: Colors.grey.shade500,
),
textAlign: TextAlign.center,
),
],
),
),
@ -192,17 +216,18 @@ class JadwalSectionWidget extends StatelessWidget {
controller.getKategoriBantuanName(jadwal.kategoriBantuanId);
return Card(
margin: const EdgeInsets.only(bottom: 12),
elevation: 2,
margin: const EdgeInsets.only(bottom: 16),
elevation: 3,
shadowColor: Colors.black.withOpacity(0.1),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
borderRadius: BorderRadius.circular(16),
side: BorderSide(
color: statusColor.withOpacity(0.3),
width: 1,
width: 1.5,
),
),
child: InkWell(
borderRadius: BorderRadius.circular(12),
borderRadius: BorderRadius.circular(16),
onTap: () {
if (jadwal.id != null) {
Get.toNamed(Routes.detailPenyaluran,
@ -223,19 +248,19 @@ class JadwalSectionWidget extends StatelessWidget {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Container(
// padding: const EdgeInsets.all(10),
// decoration: BoxDecoration(
// color: statusColor.withOpacity(0.1),
// borderRadius: BorderRadius.circular(10),
// ),
// child: Icon(
// _getStatusIcon(),
// color: statusColor,
// size: 24,
// ),
// ),
// const SizedBox(width: 12),
Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: statusColor.withOpacity(0.1),
borderRadius: BorderRadius.circular(12),
),
child: Icon(
_getStatusIcon(),
color: statusColor,
size: 24,
),
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -254,12 +279,16 @@ class JadwalSectionWidget extends StatelessWidget {
),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
horizontal: 10,
vertical: 6,
),
decoration: BoxDecoration(
color: statusColor.withOpacity(0.1),
borderRadius: BorderRadius.circular(12),
color: statusColor.withOpacity(0.15),
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: statusColor.withOpacity(0.3),
width: 1,
),
),
child: Text(
statusText,
@ -273,10 +302,12 @@ class JadwalSectionWidget extends StatelessWidget {
),
if (jadwal.deskripsi != null &&
jadwal.deskripsi!.isNotEmpty) ...[
const SizedBox(height: 4),
const SizedBox(height: 6),
Text(
jadwal.deskripsi!,
style: textTheme.bodyMedium,
style: textTheme.bodyMedium?.copyWith(
color: Colors.grey.shade700,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
@ -287,47 +318,18 @@ class JadwalSectionWidget extends StatelessWidget {
],
),
const Divider(height: 24),
_buildInfoItem(
Icons.location_on_outlined,
'Lokasi',
lokasiName,
_buildInfoSection(
textTheme,
lokasiName,
kategoriName,
formattedDateTime,
jadwal.jumlahPenerima,
),
const SizedBox(height: 8),
Row(
children: [
Expanded(
child: _buildInfoItem(
Icons.category_outlined,
'Kategori',
kategoriName,
textTheme,
),
),
Expanded(
child: _buildInfoItem(
Icons.event,
'Jadwal',
formattedDateTime,
textTheme,
),
),
],
),
if (jadwal.jumlahPenerima != null) ...[
const SizedBox(height: 8),
_buildInfoItem(
Icons.people_outline,
'Jumlah Penerima',
'${jadwal.jumlahPenerima}',
textTheme,
),
],
const SizedBox(height: 16),
const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton.icon(
ElevatedButton.icon(
onPressed: () {
if (jadwal.id != null) {
Get.toNamed(Routes.detailPenyaluran,
@ -340,10 +342,19 @@ class JadwalSectionWidget extends StatelessWidget {
);
}
},
icon: const Icon(Icons.visibility_outlined),
icon: const Icon(Icons.visibility_outlined, size: 18),
label: const Text('Lihat Detail'),
style: TextButton.styleFrom(
foregroundColor: statusColor,
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white,
backgroundColor: statusColor,
elevation: 0,
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
),
],
@ -355,6 +366,66 @@ class JadwalSectionWidget extends StatelessWidget {
);
}
Widget _buildInfoSection(
TextTheme textTheme,
String lokasiName,
String kategoriName,
String formattedDateTime,
int? jumlahPenerima,
) {
return Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.grey.shade50,
borderRadius: BorderRadius.circular(10),
border: Border.all(
color: Colors.grey.shade200,
width: 1,
),
),
child: Column(
children: [
_buildInfoItem(
Icons.location_on_outlined,
'Lokasi',
lokasiName,
textTheme,
),
const SizedBox(height: 10),
Row(
children: [
Expanded(
child: _buildInfoItem(
Icons.category_outlined,
'Kategori',
kategoriName,
textTheme,
),
),
Expanded(
child: _buildInfoItem(
Icons.event,
'Jadwal',
formattedDateTime,
textTheme,
),
),
],
),
if (jumlahPenerima != null) ...[
const SizedBox(height: 10),
_buildInfoItem(
Icons.people_outline,
'Jumlah Penerima',
'$jumlahPenerima',
textTheme,
),
],
],
),
);
}
Widget _buildInfoItem(
IconData icon,
String label,
@ -364,12 +435,19 @@ class JadwalSectionWidget extends StatelessWidget {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
icon,
size: 16,
color: Colors.grey.shade600,
Container(
padding: const EdgeInsets.all(6),
decoration: BoxDecoration(
color: Colors.grey.shade200,
borderRadius: BorderRadius.circular(6),
),
child: Icon(
icon,
size: 14,
color: Colors.grey.shade700,
),
),
const SizedBox(width: 4),
const SizedBox(width: 8),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -378,11 +456,15 @@ class JadwalSectionWidget extends StatelessWidget {
label,
style: textTheme.bodySmall?.copyWith(
color: Colors.grey.shade600,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 2),
Text(
value,
style: textTheme.bodyMedium,
style: textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w500,
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),

View File

@ -7,7 +7,7 @@ import 'package:penyaluran_app/app/data/models/user_model.dart';
import 'package:penyaluran_app/app/data/models/skema_bantuan_model.dart';
import 'package:penyaluran_app/app/modules/auth/controllers/auth_controller.dart';
import 'package:penyaluran_app/app/services/supabase_service.dart';
import 'package:penyaluran_app/app/utils/date_time_helper.dart';
import 'package:penyaluran_app/app/utils/format_helper.dart';
import 'dart:async';
import 'dart:convert';
import 'package:crypto/crypto.dart';

View File

@ -4,7 +4,7 @@ import 'package:penyaluran_app/app/data/models/penerima_penyaluran_model.dart';
import 'package:penyaluran_app/app/data/models/penyaluran_bantuan_model.dart';
import 'package:penyaluran_app/app/data/models/skema_bantuan_model.dart';
import 'package:penyaluran_app/app/services/supabase_service.dart';
import 'package:penyaluran_app/app/utils/date_time_helper.dart';
import 'package:penyaluran_app/app/utils/format_helper.dart';
import 'package:penyaluran_app/app/theme/app_theme.dart';
class PelaksanaanPenyaluranController extends GetxController {

View File

@ -1,7 +1,7 @@
import 'package:get/get.dart';
import 'package:flutter/material.dart';
import 'package:penyaluran_app/app/services/supabase_service.dart';
import 'package:penyaluran_app/app/utils/date_time_helper.dart';
import 'package:penyaluran_app/app/utils/format_helper.dart';
class PenerimaController extends GetxController {
final RxList<Map<String, dynamic>> daftarPenerima =

View File

@ -296,6 +296,32 @@ class PengaduanController extends GetxController {
}
}
Future<void> updateStatusTindakan(String pengaduanId) async {
isLoading.value = true;
try {
await _supabaseService.updateStatusPengaduan(pengaduanId, 'TINDAKAN');
await loadPengaduanData();
Get.snackbar(
'Sukses',
'Pengaduan berhasil diubah ke status Tindakan',
snackPosition: SnackPosition.TOP,
backgroundColor: Colors.blue,
colorText: Colors.white,
);
} catch (e) {
print('Error updating to Tindakan status: $e');
Get.snackbar(
'Error',
'Gagal mengubah status ke Tindakan: ${e.toString()}',
snackPosition: SnackPosition.TOP,
backgroundColor: Colors.red,
colorText: Colors.white,
);
} finally {
isLoading.value = false;
}
}
Future<List<TindakanPengaduanModel>> getTindakanPengaduan(
String pengaduanId) async {
try {

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:penyaluran_app/app/routes/app_pages.dart';
import 'package:penyaluran_app/app/utils/date_time_helper.dart';
import 'package:penyaluran_app/app/utils/format_helper.dart';
import 'package:percent_indicator/circular_percent_indicator.dart';
import 'package:penyaluran_app/app/modules/petugas_desa/components/greeting_header.dart';
import 'package:penyaluran_app/app/modules/petugas_desa/components/schedule_card.dart';

View File

@ -4,7 +4,7 @@ import 'package:penyaluran_app/app/modules/petugas_desa/controllers/donatur_cont
import 'package:penyaluran_app/app/data/models/donatur_model.dart';
import 'package:penyaluran_app/app/data/models/penitipan_bantuan_model.dart';
import 'package:penyaluran_app/app/widgets/dialogs/detail_penitipan_dialog.dart';
import 'package:penyaluran_app/app/utils/date_time_helper.dart';
import 'package:penyaluran_app/app/utils/format_helper.dart';
class DetailDonaturView extends GetView<DonaturController> {
const DetailDonaturView({super.key});

View File

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:penyaluran_app/app/modules/petugas_desa/controllers/penerima_controller.dart';
import 'package:penyaluran_app/app/theme/app_theme.dart';
import 'package:penyaluran_app/app/utils/date_time_helper.dart';
import 'package:penyaluran_app/app/utils/format_helper.dart';
class DetailPenerimaView extends GetView<PenerimaController> {
const DetailPenerimaView({super.key});

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@ import 'package:image_picker/image_picker.dart';
import 'package:signature/signature.dart';
import 'dart:io';
import 'dart:typed_data';
import 'package:penyaluran_app/app/utils/date_time_helper.dart';
import 'package:penyaluran_app/app/utils/format_helper.dart';
class KonfirmasiPenerimaPage extends StatefulWidget {
final PenerimaPenyaluranModel penerima;

View File

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:penyaluran_app/app/modules/petugas_desa/controllers/pengaduan_controller.dart';
import 'package:penyaluran_app/app/theme/app_theme.dart';
import 'package:penyaluran_app/app/utils/date_time_helper.dart';
import 'package:penyaluran_app/app/utils/format_helper.dart';
class PengaduanView extends GetView<PengaduanController> {
const PengaduanView({super.key});

View File

@ -3,7 +3,7 @@ import 'package:get/get.dart';
import 'package:penyaluran_app/app/data/models/penitipan_bantuan_model.dart';
import 'package:penyaluran_app/app/modules/petugas_desa/controllers/penitipan_bantuan_controller.dart';
import 'package:penyaluran_app/app/theme/app_theme.dart';
import 'package:penyaluran_app/app/utils/date_time_helper.dart';
import 'package:penyaluran_app/app/utils/format_helper.dart';
import 'package:penyaluran_app/app/widgets/dialogs/detail_penitipan_dialog.dart';
import 'dart:io';

View File

@ -8,7 +8,6 @@ import 'package:penyaluran_app/app/modules/petugas_desa/views/tambah_penyaluran_
class PenyaluranView extends GetView<JadwalPenyaluranController> {
const PenyaluranView({super.key});
@override
Widget build(BuildContext context) {
return DefaultTabController(
@ -24,6 +23,10 @@ class PenyaluranView extends GetView<JadwalPenyaluranController> {
labelColor: AppTheme.primaryColor,
indicatorColor: AppTheme.primaryColor,
unselectedLabelColor: Colors.grey,
unselectedLabelStyle: const TextStyle(
fontWeight: FontWeight.w500,
fontSize: 13,
),
),
Expanded(
child: TabBarView(
@ -38,10 +41,13 @@ class PenyaluranView extends GetView<JadwalPenyaluranController> {
),
],
),
floatingActionButton: FloatingActionButton(
floatingActionButton: FloatingActionButton.extended(
onPressed: () => Get.to(() => const TambahPenyaluranView()),
backgroundColor: AppTheme.primaryColor,
child: const Icon(Icons.add, color: Colors.white),
icon: const Icon(Icons.add, color: Colors.white),
label: const Text('Tambah Jadwal',
style: TextStyle(color: Colors.white)),
elevation: 2,
),
),
);
@ -53,12 +59,12 @@ class PenyaluranView extends GetView<JadwalPenyaluranController> {
child: SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
child: Padding(
padding: const EdgeInsets.all(16.0),
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 20.0),
child: Obx(() {
if (controller.isLoading.value) {
return const Center(
child: Padding(
padding: EdgeInsets.all(32.0),
return const SizedBox(
height: 300,
child: Center(
child: CircularProgressIndicator(),
),
);
@ -70,7 +76,7 @@ class PenyaluranView extends GetView<JadwalPenyaluranController> {
// Ringkasan jadwal
_buildJadwalSummary(Get.context!),
const SizedBox(height: 20),
const SizedBox(height: 24),
// Jadwal hari ini
JadwalSectionWidget(
@ -80,7 +86,7 @@ class PenyaluranView extends GetView<JadwalPenyaluranController> {
status: 'Aktif',
),
const SizedBox(height: 20),
const SizedBox(height: 24),
// Jadwal mendatang
JadwalSectionWidget(
@ -90,7 +96,7 @@ class PenyaluranView extends GetView<JadwalPenyaluranController> {
status: 'Terjadwal',
),
const SizedBox(height: 50),
const SizedBox(height: 60),
],
);
}),
@ -105,12 +111,12 @@ class PenyaluranView extends GetView<JadwalPenyaluranController> {
child: SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
child: Padding(
padding: const EdgeInsets.all(16.0),
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 20.0),
child: Obx(() {
if (controller.isLoading.value) {
return const Center(
child: Padding(
padding: EdgeInsets.all(32.0),
return const SizedBox(
height: 300,
child: Center(
child: CircularProgressIndicator(),
),
);

View File

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:penyaluran_app/app/modules/petugas_desa/controllers/riwayat_pengaduan_controller.dart';
import 'package:penyaluran_app/app/theme/app_theme.dart';
import 'package:penyaluran_app/app/utils/date_time_helper.dart';
import 'package:penyaluran_app/app/utils/format_helper.dart';
class RiwayatPengaduanView extends GetView<RiwayatPengaduanController> {
const RiwayatPengaduanView({super.key});
@ -159,253 +159,388 @@ class RiwayatPengaduanView extends GetView<RiwayatPengaduanController> {
formattedDate = DateTimeHelper.formatDate(item.createdAt);
}
return InkWell(
onTap: () {
// Navigasi ke halaman detail pengaduan
Get.toNamed('/detail-pengaduan', arguments: {'id': item.id});
},
borderRadius: BorderRadius.circular(12),
child: Container(
width: double.infinity,
margin: const EdgeInsets.only(bottom: 12),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.grey.withAlpha(26),
spreadRadius: 1,
blurRadius: 3,
offset: const Offset(0, 1),
),
],
Color statusColor = AppTheme.successColor;
IconData statusIcon = Icons.check_circle;
return Card(
margin: const EdgeInsets.only(bottom: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
side: BorderSide(
color: statusColor.withOpacity(0.3),
width: 1,
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
),
elevation: 3,
child: InkWell(
onTap: () {
// Navigasi ke halaman detail pengaduan
Get.toNamed('/detail-pengaduan', arguments: {'id': item.id});
},
borderRadius: BorderRadius.circular(12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
// Header dengan warna sesuai status
Container(
width: double.infinity,
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
decoration: BoxDecoration(
color: statusColor.withOpacity(0.1),
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(12),
topRight: Radius.circular(12),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
item.warga?['nama'] ?? item.judul ?? '',
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
child: Row(
children: [
Icon(
Icons.report_problem,
color: statusColor,
),
const SizedBox(width: 8),
Flexible(
child: Text(
item.warga?['nama'] ?? item.judul ?? '',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: statusColor,
),
overflow: TextOverflow.ellipsis,
),
),
],
),
),
const SizedBox(width: 12),
Container(
padding:
const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
decoration: BoxDecoration(
color: AppTheme.successColor.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
color: Colors.white,
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: statusColor,
width: 1.0,
),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 3,
offset: const Offset(0, 1),
),
],
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(
Icons.check_circle,
size: 16,
color: AppTheme.successColor,
Icon(
statusIcon,
size: 14,
color: statusColor,
),
const SizedBox(width: 4),
Text(
'SELESAI',
style:
Theme.of(context).textTheme.bodySmall?.copyWith(
color: AppTheme.successColor,
fontWeight: FontWeight.bold,
),
style: TextStyle(
color: statusColor,
fontWeight: FontWeight.bold,
fontSize: 12,
),
),
],
),
),
],
),
const SizedBox(height: 8),
Text(
item.deskripsi ?? '',
style: Theme.of(context).textTheme.bodyMedium,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 12),
Row(
),
Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: _buildItemDetail(
context,
icon: Icons.person,
label: 'Pelapor',
value: item.warga?['nama_lengkap'] ?? '',
),
),
Expanded(
child: _buildItemDetail(
context,
icon: Icons.numbers,
label: 'NIK',
value: item.warga?['nik'] ?? '',
),
),
],
),
const SizedBox(height: 12),
if (item.penerimaPenyaluran != null) ...[
Row(
children: [
Expanded(
child: _buildItemDetail(
context,
icon: Icons.shopping_bag,
label: 'Jumlah',
value:
'${item.jumlahBantuan} ${item.stokBantuan['satuan']}',
)),
Expanded(
child: _buildItemDetail(
context,
icon: Icons.inventory,
label: 'Stok Bantuan',
value: item.stokBantuan['nama'] ?? '',
// Deskripsi masalah
if (item.deskripsi != null && item.deskripsi.isNotEmpty)
Container(
width: double.infinity,
padding: const EdgeInsets.all(12),
margin: const EdgeInsets.only(bottom: 16),
decoration: BoxDecoration(
color: Colors.grey.shade50,
borderRadius: BorderRadius.circular(10),
border: Border.all(
color: Colors.grey.shade200,
width: 1.0,
),
),
),
],
),
const SizedBox(height: 8),
Row(
children: [
Expanded(
child: _buildItemDetail(
context,
icon: Icons.category,
label: 'Nama Penyaluran',
value: item.namaPenyaluran ?? '',
),
),
Expanded(
child: _buildItemDetail(
context,
icon: Icons.calendar_today,
label: 'Tanggal',
value: formattedDate,
),
),
],
),
],
if (item.ratingWarga != null && item.ratingWarga > 0) ...[
const SizedBox(height: 12),
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.amber.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.amber.shade200),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Feedback Warga',
style: const TextStyle(
'Deskripsi Masalah:',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Colors.amber,
color: Colors.grey.shade800,
),
),
Row(
children: List.generate(5, (index) {
return Icon(
index < (item.ratingWarga ?? 0)
? Icons.star
: Icons.star_border,
color: Colors.amber,
size: 16,
);
}),
const SizedBox(height: 6),
Text(
item.deskripsi ?? '',
style: TextStyle(
color: Colors.grey.shade700,
),
),
],
),
if (item.feedbackWarga != null &&
item.feedbackWarga.isNotEmpty) ...[
const SizedBox(height: 4),
Text(
'${item.feedbackWarga}',
style: Theme.of(context).textTheme.bodySmall,
),
// Informasi penyaluran bantuan jika ada
if (item.penerimaPenyaluran != null) ...[
Container(
width: double.infinity,
padding: const EdgeInsets.all(12),
margin: const EdgeInsets.only(bottom: 16),
decoration: BoxDecoration(
color: Colors.blue.shade50,
borderRadius: BorderRadius.circular(10),
border: Border.all(
color: Colors.blue.shade200,
width: 1.0,
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Penyaluran: ${item.namaPenyaluran ?? "Tidak tersedia"}',
style: const TextStyle(
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 6),
Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Bantuan',
style: TextStyle(
fontSize: 12,
color: Colors.grey.shade600,
),
),
Text(
item.stokBantuan['nama'] ?? '-',
style: TextStyle(
fontWeight: FontWeight.w500,
color: Colors.grey.shade800,
),
),
],
),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Jumlah',
style: TextStyle(
fontSize: 12,
color: Colors.grey.shade600,
),
),
Text(
'${item.jumlahBantuan} ${item.stokBantuan['satuan'] ?? ''}',
style: TextStyle(
fontWeight: FontWeight.w500,
color: Colors.grey.shade800,
),
),
],
),
),
],
),
],
),
),
],
// Informasi pelapor dan NIK
Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Pelapor',
style: TextStyle(
fontSize: 12,
color: Colors.grey.shade600,
),
),
Text(
item.warga?['nama_lengkap'] ?? '-',
style: TextStyle(
fontWeight: FontWeight.w500,
color: Colors.grey.shade800,
),
),
],
),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'NIK',
style: TextStyle(
fontSize: 12,
color: Colors.grey.shade600,
),
),
Text(
item.warga?['nik'] ?? '-',
style: TextStyle(
fontWeight: FontWeight.w500,
color: Colors.grey.shade800,
),
),
],
),
),
],
),
),
],
const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton.icon(
onPressed: () {
// Navigasi ke halaman detail pengaduan
Get.toNamed('/detail-pengaduan',
arguments: {'id': item.id});
},
icon: const Icon(Icons.info_outline, size: 18),
label: const Text('Detail'),
style: TextButton.styleFrom(
foregroundColor: Colors.grey,
padding: const EdgeInsets.symmetric(horizontal: 8),
const SizedBox(height: 12),
// Informasi tanggal
Container(
padding:
const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: Colors.grey.shade100,
borderRadius: BorderRadius.circular(4),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.calendar_today,
size: 12,
color: Colors.grey.shade700,
),
const SizedBox(width: 4),
Text(
formattedDate,
style: TextStyle(
fontSize: 12,
color: Colors.grey.shade800,
),
),
],
),
),
// Rating dan feedback warga jika ada
if (item.ratingWarga != null && item.ratingWarga > 0) ...[
const SizedBox(height: 12),
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.amber.withOpacity(0.1),
borderRadius: BorderRadius.circular(10),
border: Border.all(
color: Colors.amber.shade200,
width: 1.0,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Feedback Warga',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Colors.amber.shade800,
),
),
Row(
children: List.generate(5, (index) {
return Icon(
index < (item.ratingWarga ?? 0)
? Icons.star
: Icons.star_border,
color: Colors.amber,
size: 16,
);
}),
),
],
),
if (item.feedbackWarga != null &&
item.feedbackWarga.isNotEmpty) ...[
const SizedBox(height: 6),
Text(
'${item.feedbackWarga}',
style: TextStyle(
color: Colors.grey.shade700,
),
),
],
],
),
),
],
const SizedBox(height: 12),
// Tombol detail
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton.icon(
onPressed: () {
Get.toNamed('/detail-pengaduan',
arguments: {'id': item.id});
},
icon: const Icon(Icons.info_outline, size: 18),
label: const Text('Lihat Detail'),
style: ElevatedButton.styleFrom(
backgroundColor: statusColor,
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 8),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
),
],
),
],
),
],
),
),
],
),
),
);
}
Widget _buildItemDetail(
BuildContext context, {
required IconData icon,
required String label,
required String value,
}) {
return Row(
children: [
Icon(
icon,
size: 16,
color: Colors.grey,
),
const SizedBox(width: 4),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Colors.grey,
),
),
Text(
value,
style: Theme.of(context).textTheme.bodyMedium,
overflow: TextOverflow.ellipsis,
),
],
),
),
],
);
}
}

View File

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:penyaluran_app/app/data/models/penitipan_bantuan_model.dart';
import 'package:penyaluran_app/app/modules/petugas_desa/controllers/penitipan_bantuan_controller.dart';
import 'package:penyaluran_app/app/utils/date_time_helper.dart';
import 'package:penyaluran_app/app/utils/format_helper.dart';
import 'package:penyaluran_app/app/theme/app_theme.dart';
class RiwayatPenitipanView extends GetView<PenitipanBantuanController> {
@ -208,151 +208,348 @@ class RiwayatPenitipanView extends GetView<PenitipanBantuanController> {
return Container(
width: double.infinity,
margin: const EdgeInsets.only(bottom: 12),
margin: const EdgeInsets.only(bottom: 16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.grey.withAlpha(26),
spreadRadius: 1,
blurRadius: 3,
offset: const Offset(0, 1),
color: Colors.grey.withOpacity(0.15),
spreadRadius: 2,
blurRadius: 8,
offset: const Offset(0, 3),
),
],
border: Border.all(
color: statusColor.withOpacity(0.3),
width: 1,
),
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
donaturNama,
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
),
overflow: TextOverflow.ellipsis,
),
),
Container(
padding:
const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: statusColor.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
),
child: Row(
mainAxisSize: MainAxisSize.min,
// Header dengan status
Container(
color: statusColor.withOpacity(0.1),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Icon(
statusIcon,
size: 16,
color: statusColor,
Container(
padding: const EdgeInsets.all(6),
decoration: BoxDecoration(
color: statusColor.withOpacity(0.2),
shape: BoxShape.circle,
),
child: Icon(
statusIcon,
size: 16,
color: statusColor,
),
),
const SizedBox(width: 4),
const SizedBox(width: 8),
Text(
item.status ?? 'Tidak diketahui',
style: Theme.of(context).textTheme.bodySmall?.copyWith(
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: statusColor,
fontWeight: FontWeight.bold,
),
),
],
),
),
],
),
const SizedBox(height: 12),
Row(
children: [
Expanded(
child: _buildItemDetail(
context,
icon: isUang ? Icons.monetization_on : Icons.category,
label: 'Kategori Bantuan',
value: kategoriNama,
),
),
Expanded(
child: _buildItemDetail(
context,
icon:
isUang ? Icons.account_balance_wallet : Icons.inventory,
label: 'Jumlah',
value: isUang
? 'Rp ${DateTimeHelper.formatNumber(item.jumlah)}'
: '${DateTimeHelper.formatNumber(item.jumlah)} $kategoriSatuan',
),
),
],
),
const SizedBox(height: 8),
Row(
children: [
Expanded(
child: _buildItemDetail(
context,
icon: Icons.calendar_today,
label: item.status == 'TERVERIFIKASI'
? 'Tanggal Verifikasi'
: 'Tanggal Penolakan',
value: DateTimeHelper.formatDateTime(
item.status == 'TERVERIFIKASI'
? item.tanggalVerifikasi
: item.updatedAt,
defaultValue: 'Tidak ada tanggal'),
),
),
if (item.status == 'TERVERIFIKASI' &&
item.petugasDesaId != null)
Expanded(
child: GetBuilder<PenitipanBantuanController>(
id: 'petugas_data',
builder: (controller) => _buildItemDetail(
context,
icon: Icons.person,
label: 'Diverifikasi Oleh',
value:
controller.getPetugasDesaNama(item.petugasDesaId),
),
),
),
],
),
if (item.alasanPenolakan != null &&
item.alasanPenolakan!.isNotEmpty)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 8),
_buildItemDetail(
context,
icon: Icons.info_outline,
label: 'Alasan Penolakan',
value: item.alasanPenolakan!,
Text(
DateTimeHelper.formatDate(item.createdAt),
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Colors.grey.shade700,
fontStyle: FontStyle.italic,
),
),
],
),
const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton.icon(
onPressed: () {
_showDetailDialog(context, item, donaturNama);
},
icon: const Icon(Icons.info_outline, size: 18),
label: const Text('Detail'),
style: TextButton.styleFrom(
foregroundColor: Colors.blue,
padding: const EdgeInsets.symmetric(horizontal: 8),
),
// Content
Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Donatur info
Row(
children: [
CircleAvatar(
backgroundColor: AppTheme.primaryColor.withOpacity(0.1),
radius: 20,
child: Text(
donaturNama.isNotEmpty
? donaturNama.substring(0, 1).toUpperCase()
: '?',
style: TextStyle(
color: AppTheme.primaryColor,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
donaturNama,
style: Theme.of(context)
.textTheme
.titleMedium
?.copyWith(
fontWeight: FontWeight.bold,
),
overflow: TextOverflow.ellipsis,
),
Text(
'Donatur',
style: Theme.of(context)
.textTheme
.bodySmall
?.copyWith(
color: Colors.grey,
),
),
],
),
),
],
),
const SizedBox(height: 16),
const Divider(),
const SizedBox(height: 12),
// Informasi bantuan
Row(
children: [
Expanded(
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: isUang
? Colors.green.withOpacity(0.1)
: Colors.blue.withOpacity(0.1),
borderRadius: BorderRadius.circular(12),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(
isUang
? Icons.monetization_on
: Icons.category,
size: 16,
color: isUang ? Colors.green : Colors.blue,
),
const SizedBox(width: 6),
Text(
'Kategori',
style: Theme.of(context)
.textTheme
.bodySmall
?.copyWith(
color: isUang
? Colors.green
: Colors.blue,
),
),
],
),
const SizedBox(height: 4),
Text(
kategoriNama,
style: Theme.of(context)
.textTheme
.titleSmall
?.copyWith(
fontWeight: FontWeight.bold,
),
overflow: TextOverflow.ellipsis,
),
],
),
),
),
const SizedBox(width: 12),
Expanded(
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: isUang
? Colors.amber.withOpacity(0.1)
: Colors.purple.withOpacity(0.1),
borderRadius: BorderRadius.circular(12),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(
isUang
? Icons.account_balance_wallet
: Icons.inventory,
size: 16,
color: isUang
? Colors.amber.shade800
: Colors.purple,
),
const SizedBox(width: 6),
Text(
'Jumlah',
style: Theme.of(context)
.textTheme
.bodySmall
?.copyWith(
color: isUang
? Colors.amber.shade800
: Colors.purple,
),
),
],
),
const SizedBox(height: 4),
Text(
isUang
? 'Rp ${DateTimeHelper.formatNumber(item.jumlah)}'
: '${DateTimeHelper.formatNumber(item.jumlah)} $kategoriSatuan',
style: Theme.of(context)
.textTheme
.titleSmall
?.copyWith(
fontWeight: FontWeight.bold,
),
overflow: TextOverflow.ellipsis,
),
],
),
),
),
],
),
// Verifikasi info
if (item.status == 'TERVERIFIKASI' &&
item.petugasDesaId != null)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 12),
const Divider(),
const SizedBox(height: 10),
Row(
children: [
Icon(
Icons.verified_user,
size: 16,
color: Colors.green,
),
const SizedBox(width: 6),
Expanded(
child: RichText(
text: TextSpan(
style: Theme.of(context).textTheme.bodyMedium,
children: [
TextSpan(
text: 'Diverifikasi oleh ',
style: TextStyle(
color: Colors.grey.shade700),
),
TextSpan(
text: controller.getPetugasDesaNama(
item.petugasDesaId),
style: const TextStyle(
fontWeight: FontWeight.bold,
color: Colors.green,
),
),
],
),
),
),
],
),
],
),
// Alasan penolakan jika ditolak
if (item.status == 'DITOLAK' &&
item.alasanPenolakan != null &&
item.alasanPenolakan!.isNotEmpty)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 12),
const Divider(),
const SizedBox(height: 10),
Row(
children: [
Icon(
Icons.info_outline,
size: 16,
color: Colors.red,
),
const SizedBox(width: 6),
Text(
'Alasan Penolakan',
style: Theme.of(context)
.textTheme
.bodyMedium
?.copyWith(
color: Colors.red,
fontWeight: FontWeight.w500,
),
),
],
),
const SizedBox(height: 4),
Text(
item.alasanPenolakan!,
style: Theme.of(context).textTheme.bodyMedium,
),
],
),
],
),
),
// Footer dengan tombol aksi
Container(
decoration: BoxDecoration(
color: Colors.grey.shade50,
border: Border(
top: BorderSide(color: Colors.grey.shade200),
),
],
),
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton.icon(
onPressed: () {
_showDetailDialog(context, item, donaturNama);
},
icon: const Icon(Icons.info_outline, size: 16),
label: const Text('Lihat Detail'),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 8),
),
),
],
),
),
],
),
@ -360,42 +557,6 @@ class RiwayatPenitipanView extends GetView<PenitipanBantuanController> {
);
}
Widget _buildItemDetail(
BuildContext context, {
required IconData icon,
required String label,
required String value,
}) {
return Row(
children: [
Icon(
icon,
size: 16,
color: Colors.grey,
),
const SizedBox(width: 4),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Colors.grey,
),
),
Text(
value,
style: Theme.of(context).textTheme.bodyMedium,
overflow: TextOverflow.ellipsis,
),
],
),
),
],
);
}
void _showDetailDialog(
BuildContext context, PenitipanBantuanModel item, String donaturNama) {
final kategoriNama = item.kategoriBantuan?.nama ??

View File

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:penyaluran_app/app/data/models/penyaluran_bantuan_model.dart';
import 'package:penyaluran_app/app/modules/petugas_desa/controllers/jadwal_penyaluran_controller.dart';
import 'package:penyaluran_app/app/utils/date_time_helper.dart';
import 'package:penyaluran_app/app/utils/format_helper.dart';
import 'package:penyaluran_app/app/theme/app_theme.dart';
class RiwayatPenyaluranView extends GetView<JadwalPenyaluranController> {

View File

@ -4,7 +4,7 @@ import 'package:penyaluran_app/app/data/models/riwayat_stok_model.dart';
import 'package:penyaluran_app/app/data/models/stok_bantuan_model.dart';
import 'package:penyaluran_app/app/modules/petugas_desa/controllers/riwayat_stok_controller.dart';
import 'package:penyaluran_app/app/theme/app_theme.dart';
import 'package:penyaluran_app/app/utils/date_time_helper.dart';
import 'package:penyaluran_app/app/utils/format_helper.dart';
import 'package:cached_network_image/cached_network_image.dart';
class RiwayatStokView extends GetView<RiwayatStokController> {
@ -60,60 +60,6 @@ class RiwayatStokView extends GetView<RiwayatStokController> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Header dengan latar belakang gradient
Container(
padding: const EdgeInsets.all(20.0),
decoration: BoxDecoration(
gradient: AppTheme.primaryGradient,
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(20),
),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 10,
spreadRadius: 1,
offset: const Offset(0, 3),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Heading
Row(
children: [
const Icon(
Icons.inventory_2_outlined,
color: Colors.white,
size: 30,
),
const SizedBox(width: 10),
Text(
'Riwayat Stok Bantuan',
style:
Theme.of(context).textTheme.headlineSmall?.copyWith(
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
],
),
const SizedBox(height: 8),
Padding(
padding: const EdgeInsets.only(left: 40),
child: Text(
'Catatan perubahan stok bantuan di desa Anda',
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Colors.white.withOpacity(0.9),
),
),
),
],
),
),
// Filter dan pencarian
Padding(
padding: const EdgeInsets.all(16.0),

View File

@ -3,7 +3,7 @@ import 'package:get/get.dart';
import 'package:penyaluran_app/app/data/models/stok_bantuan_model.dart';
import 'package:penyaluran_app/app/modules/petugas_desa/controllers/stok_bantuan_controller.dart';
import 'package:penyaluran_app/app/theme/app_theme.dart';
import 'package:penyaluran_app/app/utils/date_time_helper.dart';
import 'package:penyaluran_app/app/utils/format_helper.dart';
class StokBantuanView extends GetView<StokBantuanController> {
const StokBantuanView({super.key});
@ -17,13 +17,15 @@ class StokBantuanView extends GetView<StokBantuanController> {
? const Center(child: CircularProgressIndicator())
: _buildContent(context)),
),
floatingActionButton: FloatingActionButton(
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
// Tampilkan dialog tambah stok bantuan
_showAddStokDialog(context);
},
backgroundColor: AppTheme.primaryColor,
child: const Icon(Icons.add, color: Colors.white),
icon: const Icon(Icons.add, color: Colors.white),
label: const Text('Tambah Stok', style: TextStyle(color: Colors.white)),
elevation: 2,
),
);
}

View File

@ -3,7 +3,7 @@ import 'package:get/get.dart';
import 'package:penyaluran_app/app/modules/petugas_desa/controllers/jadwal_penyaluran_controller.dart';
import 'package:penyaluran_app/app/theme/app_theme.dart';
import 'package:penyaluran_app/app/data/models/skema_bantuan_model.dart';
import 'package:penyaluran_app/app/utils/date_time_helper.dart';
import 'package:penyaluran_app/app/utils/format_helper.dart';
class TambahPenyaluranView extends GetView<JadwalPenyaluranController> {
const TambahPenyaluranView({super.key});