diff --git a/lib/app/modules/petugas_desa/views/pengaduan_view.dart b/lib/app/modules/petugas_desa/views/pengaduan_view.dart index c5a9673..de94791 100644 --- a/lib/app/modules/petugas_desa/views/pengaduan_view.dart +++ b/lib/app/modules/petugas_desa/views/pengaduan_view.dart @@ -8,8 +8,6 @@ class PengaduanView extends GetView { @override Widget build(BuildContext context) { - final textTheme = Theme.of(context).textTheme; - return SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(16.0), diff --git a/lib/app/modules/petugas_desa/views/penitipan_view.dart b/lib/app/modules/petugas_desa/views/penitipan_view.dart index 64baed9..78f52e5 100644 --- a/lib/app/modules/petugas_desa/views/penitipan_view.dart +++ b/lib/app/modules/petugas_desa/views/penitipan_view.dart @@ -8,8 +8,6 @@ class PenitipanView extends GetView { @override Widget build(BuildContext context) { - final textTheme = Theme.of(context).textTheme; - return SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(16.0), diff --git a/lib/app/modules/petugas_desa/views/penyaluran_view.dart b/lib/app/modules/petugas_desa/views/penyaluran_view.dart index 8016ce1..31dcfd8 100644 --- a/lib/app/modules/petugas_desa/views/penyaluran_view.dart +++ b/lib/app/modules/petugas_desa/views/penyaluran_view.dart @@ -10,8 +10,6 @@ class PenyaluranView extends GetView { @override Widget build(BuildContext context) { - final textTheme = Theme.of(context).textTheme; - return SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(16.0), diff --git a/lib/app/modules/petugas_desa/views/permintaan_penjadwalan_view.dart b/lib/app/modules/petugas_desa/views/permintaan_penjadwalan_view.dart index b9d53d5..867b0db 100644 --- a/lib/app/modules/petugas_desa/views/permintaan_penjadwalan_view.dart +++ b/lib/app/modules/petugas_desa/views/permintaan_penjadwalan_view.dart @@ -22,25 +22,187 @@ class PermintaanPenjadwalanView extends GetView { onPressed: () => Get.back(), ), ), - body: Obx(() { - final permintaanList = controller.permintaanPenjadwalan; + body: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Ringkasan permintaan penjadwalan + _buildPenjadwalanSummary(context), - if (permintaanList.isEmpty) { - return _buildEmptyState(); - } + const SizedBox(height: 24), - return ListView.builder( - padding: const EdgeInsets.all(16), - itemCount: permintaanList.length, - itemBuilder: (context, index) { - final permintaan = permintaanList[index]; - return _buildPermintaanItem(context, permintaan); - }, - ); - }), + // Filter dan pencarian + _buildFilterSearch(context), + + const SizedBox(height: 20), + + // Daftar permintaan penjadwalan + _buildPenjadwalanList(context), + ], + ), + ), + ), ); } + Widget _buildPenjadwalanSummary(BuildContext context) { + return Container( + width: double.infinity, + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + gradient: AppTheme.primaryGradient, + borderRadius: BorderRadius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Ringkasan Permintaan Penjadwalan', + style: Theme.of(context).textTheme.titleLarge?.copyWith( + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + const SizedBox(height: 16), + Row( + children: [ + Expanded( + child: _buildSummaryItem( + context, + icon: Icons.pending_actions, + title: 'Menunggu', + value: '${controller.jumlahPermintaanPenjadwalan.value}', + color: Colors.orange, + ), + ), + Expanded( + child: _buildSummaryItem( + context, + icon: Icons.check_circle, + title: 'Terkonfirmasi', + value: '0', + color: Colors.green, + ), + ), + Expanded( + child: _buildSummaryItem( + context, + icon: Icons.cancel, + title: 'Ditolak', + value: '0', + color: Colors.red, + ), + ), + ], + ), + ], + ), + ); + } + + Widget _buildSummaryItem( + BuildContext context, { + required IconData icon, + required String title, + required String value, + required Color color, + }) { + return Column( + children: [ + Container( + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white.withOpacity(0.2), + shape: BoxShape.circle, + ), + child: Icon( + icon, + color: Colors.white, + size: 24, + ), + ), + const SizedBox(height: 8), + Text( + value, + style: Theme.of(context).textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + const SizedBox(height: 4), + Text( + title, + style: Theme.of(context).textTheme.bodySmall?.copyWith( + color: Colors.white, + ), + textAlign: TextAlign.center, + ), + ], + ); + } + + Widget _buildFilterSearch(BuildContext context) { + return Row( + children: [ + Expanded( + child: TextField( + decoration: InputDecoration( + hintText: 'Cari permintaan...', + prefixIcon: const Icon(Icons.search), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(12), + borderSide: BorderSide.none, + ), + filled: true, + fillColor: Colors.grey.shade100, + contentPadding: const EdgeInsets.symmetric(vertical: 0), + ), + ), + ), + const SizedBox(width: 12), + Container( + decoration: BoxDecoration( + color: Colors.grey.shade100, + borderRadius: BorderRadius.circular(12), + ), + child: IconButton( + onPressed: () { + // Tampilkan dialog filter + }, + icon: const Icon(Icons.filter_list), + tooltip: 'Filter', + ), + ), + ], + ); + } + + Widget _buildPenjadwalanList(BuildContext context) { + return Obx(() { + final permintaanList = controller.permintaanPenjadwalan; + + if (permintaanList.isEmpty) { + return _buildEmptyState(); + } + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Daftar Permintaan Penjadwalan', + style: Theme.of(context).textTheme.titleLarge?.copyWith( + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 12), + ...permintaanList.map((item) => _buildPermintaanItem(context, item)), + ], + ); + }); + } + Widget _buildEmptyState() { return Center( child: Column( @@ -74,19 +236,24 @@ class PermintaanPenjadwalanView extends GetView { ); } - Widget _buildPermintaanItem( - BuildContext context, Map permintaan) { - final textTheme = Theme.of(context).textTheme; + Widget _buildPermintaanItem(BuildContext context, Map item) { + Color statusColor = Colors.orange; + IconData statusIcon = Icons.pending_actions; - return Card( - margin: const EdgeInsets.only(bottom: 16), - elevation: 2, - shape: RoundedRectangleBorder( + return Container( + width: double.infinity, + margin: const EdgeInsets.only(bottom: 12), + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(12), - side: BorderSide( - color: Colors.orange.withAlpha(50), - width: 1, - ), + boxShadow: [ + BoxShadow( + color: Colors.grey.withAlpha(26), + spreadRadius: 1, + blurRadius: 3, + offset: const Offset(0, 1), + ), + ], ), child: Padding( padding: const EdgeInsets.all(16.0), @@ -96,59 +263,117 @@ class PermintaanPenjadwalanView extends GetView { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - permintaan['nama'] ?? '', - style: textTheme.titleMedium?.copyWith( - fontWeight: FontWeight.bold, + Expanded( + child: Text( + item['nama'] ?? '', + 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: Colors.orange.withAlpha(26), - borderRadius: BorderRadius.circular(12), + color: statusColor.withOpacity(0.1), + borderRadius: BorderRadius.circular(8), ), - child: Text( - 'Menunggu', - style: textTheme.bodySmall?.copyWith( - color: Colors.orange, - fontWeight: FontWeight.bold, - ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + statusIcon, + size: 16, + color: statusColor, + ), + const SizedBox(width: 4), + Text( + 'Menunggu', + style: Theme.of(context).textTheme.bodySmall?.copyWith( + color: statusColor, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ], + ), + const SizedBox(height: 12), + Row( + children: [ + Expanded( + child: _buildItemDetail( + context, + icon: Icons.person, + label: 'NIK', + value: item['nik'] ?? '', + ), + ), + Expanded( + child: _buildItemDetail( + context, + icon: Icons.category, + label: 'Jenis Bantuan', + value: item['jenis_bantuan'] ?? '', + ), + ), + ], + ), + const SizedBox(height: 8), + Row( + children: [ + Expanded( + child: _buildItemDetail( + context, + icon: Icons.calendar_today, + label: 'Tanggal Permintaan', + value: item['tanggal_permintaan'] ?? '', + ), + ), + Expanded( + child: _buildItemDetail( + context, + icon: Icons.location_on, + label: 'Alamat', + value: item['alamat'] ?? '', ), ), ], ), const SizedBox(height: 12), - _buildInfoRow(Icons.person, 'NIK: ${permintaan['nik'] ?? ''}'), - _buildInfoRow(Icons.category, - 'Jenis Bantuan: ${permintaan['jenis_bantuan'] ?? ''}'), - _buildInfoRow(Icons.calendar_today, - 'Tanggal Permintaan: ${permintaan['tanggal_permintaan'] ?? ''}'), - _buildInfoRow( - Icons.location_on, 'Alamat: ${permintaan['alamat'] ?? ''}'), - const SizedBox(height: 16), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - OutlinedButton.icon( - onPressed: () => _showTolakDialog(permintaan), - style: OutlinedButton.styleFrom( - foregroundColor: Colors.red, - side: const BorderSide(color: Colors.red), - ), - icon: const Icon(Icons.close), + TextButton.icon( + onPressed: () => _showTolakDialog(item), + icon: const Icon(Icons.close, size: 18), label: const Text('Tolak'), - ), - const SizedBox(width: 12), - ElevatedButton.icon( - onPressed: () => _showKonfirmasiDialog(permintaan), - style: ElevatedButton.styleFrom( - backgroundColor: AppTheme.primaryColor, - foregroundColor: Colors.white, + style: TextButton.styleFrom( + foregroundColor: Colors.red, + padding: const EdgeInsets.symmetric(horizontal: 8), ), - icon: const Icon(Icons.check), + ), + TextButton.icon( + onPressed: () => _showKonfirmasiDialog(item), + icon: const Icon(Icons.check, size: 18), label: const Text('Konfirmasi'), + style: TextButton.styleFrom( + foregroundColor: Colors.green, + padding: const EdgeInsets.symmetric(horizontal: 8), + ), + ), + TextButton.icon( + onPressed: () { + // Implementasi untuk melihat detail permintaan + }, + icon: const Icon(Icons.info_outline, size: 18), + label: const Text('Detail'), + style: TextButton.styleFrom( + foregroundColor: Colors.blue, + padding: const EdgeInsets.symmetric(horizontal: 8), + ), ), ], ), @@ -158,28 +383,39 @@ class PermintaanPenjadwalanView extends GetView { ); } - Widget _buildInfoRow(IconData icon, String text) { - return Padding( - padding: const EdgeInsets.only(bottom: 8), - child: Row( - children: [ - Icon( - icon, - size: 16, - color: Colors.grey.shade600, - ), - const SizedBox(width: 8), - Expanded( - child: Text( - text, - style: TextStyle( - fontSize: 14, - color: Colors.grey.shade800, + 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, + ), + ], ), - ], - ), + ), + ], ); } diff --git a/lib/app/modules/petugas_desa/views/petugas_desa_view.dart b/lib/app/modules/petugas_desa/views/petugas_desa_view.dart index db850e5..55edd00 100644 --- a/lib/app/modules/petugas_desa/views/petugas_desa_view.dart +++ b/lib/app/modules/petugas_desa/views/petugas_desa_view.dart @@ -19,7 +19,6 @@ class PetugasDesaView extends GetView { // Perbarui counter pengaduan secara manual saat aplikasi dimulai WidgetsBinding.instance.addPostFrameCallback((_) { controller.updatePengaduanCounter(); - print('Counter pengaduan diperbarui saat aplikasi dimulai'); }); return Scaffold( @@ -283,8 +282,6 @@ class PetugasDesaView extends GetView { )), Obx(() { final int jumlahPengaduanDiproses = controller.jumlahDiproses.value; - print( - 'Drawer - Jumlah pengaduan diproses: $jumlahPengaduanDiproses'); return ListTile( leading: Stack( @@ -414,9 +411,6 @@ class PetugasDesaView extends GetView { print('Jumlah jadwal hari ini: ${controller.jadwalHariIni.length}'); return Obx(() { - // Hitung jumlah pengaduan yang diproses - final int jumlahPengaduanDiproses = controller.jumlahDiproses.value; - return BottomNavigationBar( currentIndex: controller.activeTabIndex.value, onTap: controller.changeTab,