From 5814b1954688454ef5b62f9cb1890e71dc921695 Mon Sep 17 00:00:00 2001 From: Khafidh Fuadi Date: Sun, 16 Mar 2025 15:26:29 +0700 Subject: [PATCH] Perbarui tampilan CalendarViewWidget dengan menambahkan padding dan memperbaiki pengaturan gaya untuk meningkatkan pengalaman pengguna. Sederhanakan struktur tampilan di PenyaluranView dengan menghapus elemen yang tidak perlu dan langsung menampilkan CalendarViewWidget. --- .../arm64-v8a/configure_fingerprint.bin | 24 +-- .../armeabi-v7a/configure_fingerprint.bin | 24 +-- .../626b5o2n/x86/configure_fingerprint.bin | 24 +-- .../626b5o2n/x86_64/configure_fingerprint.bin | 24 +-- .../penyaluran/detail_penyaluran_page.dart | 121 +++----------- .../penyaluran/konfirmasi_penerima_page.dart | 10 +- .../components/calendar_view_widget.dart | 150 +++++++++--------- .../controllers/penerima_controller.dart | 4 +- .../views/detail_donatur_view.dart | 6 +- .../views/detail_penerima_view.dart | 82 +--------- .../petugas_desa/views/penitipan_view.dart | 18 +-- .../petugas_desa/views/penyaluran_view.dart | 14 +- .../views/riwayat_penitipan_view.dart | 26 +-- .../views/riwayat_penyaluran_view.dart | 16 +- .../petugas_desa/views/stok_bantuan_view.dart | 20 +-- .../views/tambah_penyaluran_view.dart | 4 +- lib/app/utils/date_formatter.dart | 60 ------- lib/app/utils/date_time_helper.dart | 66 ++++++-- lib/app/widgets/detail_penitipan_dialog.dart | 12 +- 19 files changed, 265 insertions(+), 440 deletions(-) delete mode 100644 lib/app/utils/date_formatter.dart diff --git a/android/app/.cxx/Debug/626b5o2n/arm64-v8a/configure_fingerprint.bin b/android/app/.cxx/Debug/626b5o2n/arm64-v8a/configure_fingerprint.bin index 7bc2885..476d84c 100644 --- a/android/app/.cxx/Debug/626b5o2n/arm64-v8a/configure_fingerprint.bin +++ b/android/app/.cxx/Debug/626b5o2n/arm64-v8a/configure_fingerprint.bin @@ -2,27 +2,27 @@ C/C++ Structured LogO M KC:\dev\flutter\packages\flutter_tools\gradle\src\main\groovy\CMakeLists.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ۈ2 2 +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  2 2  -}D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\additional_project_files.txt  ۈ2  2~ +}D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\additional_project_files.txt  2  2~ | -zD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\android_gradle_build.json  ۈ2 2 +zD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\android_gradle_build.json  2 2  -D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\android_gradle_build_mini.json  ۈ2 2p +D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\android_gradle_build_mini.json  2 2p n -lD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\build.ninja  ۈ2 2t +lD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\build.ninja  2 2t r -pD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\build.ninja.txt  ۈ2y +pD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\build.ninja.txt  2y w -uD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\build_file_index.txt  ۈ2 K 2z +uD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\build_file_index.txt  2 K 2z x -vD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\compile_commands.json  ۈ2 ~ +vD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\compile_commands.json  2 ~ | -zD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\compile_commands.json.bin  ۈ2 +zD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\compile_commands.json.bin  2   -D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\metadata_generation_command.txt  ۈ2  2w +D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\metadata_generation_command.txt  2  2w u -sD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\prefab_config.json  ۈ2  ( 2| +sD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\prefab_config.json  2  ( 2| z -xD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\symbol_folder_index.txt  ۈ2  o 2 \ No newline at end of file +xD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\arm64-v8a\symbol_folder_index.txt  2  o 2 \ No newline at end of file diff --git a/android/app/.cxx/Debug/626b5o2n/armeabi-v7a/configure_fingerprint.bin b/android/app/.cxx/Debug/626b5o2n/armeabi-v7a/configure_fingerprint.bin index 5411842..af6d5e7 100644 --- a/android/app/.cxx/Debug/626b5o2n/armeabi-v7a/configure_fingerprint.bin +++ b/android/app/.cxx/Debug/626b5o2n/armeabi-v7a/configure_fingerprint.bin @@ -2,27 +2,27 @@ C/C++ Structured LogO M KC:\dev\flutter\packages\flutter_tools\gradle\src\main\groovy\CMakeLists.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ܈2 2 +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  2 2  -D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\additional_project_files.txt  ܈2  2 +D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\additional_project_files.txt  2  2 ~ -|D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\android_gradle_build.json  ܈2 2 +|D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\android_gradle_build.json  2 2  -D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\android_gradle_build_mini.json  ܈2 2r +D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\android_gradle_build_mini.json  2 2r p -nD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\build.ninja  ܈2 2v +nD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\build.ninja  2 2v t -rD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\build.ninja.txt  ܈2{ +rD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\build.ninja.txt  2{ y -wD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\build_file_index.txt  ܈2 K 2| +wD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\build_file_index.txt  2 K 2| z -xD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\compile_commands.json  ܈2  +xD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\compile_commands.json  2  ~ -|D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\compile_commands.json.bin  ܈2 +|D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\compile_commands.json.bin  2   -D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\metadata_generation_command.txt  ܈2  2y +D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\metadata_generation_command.txt  2  2y w -uD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\prefab_config.json  ܈2  ( 2~ +uD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\prefab_config.json  2  ( 2~ | -zD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\symbol_folder_index.txt  ܈2  q 2 \ No newline at end of file +zD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\armeabi-v7a\symbol_folder_index.txt  2  q 2 \ No newline at end of file diff --git a/android/app/.cxx/Debug/626b5o2n/x86/configure_fingerprint.bin b/android/app/.cxx/Debug/626b5o2n/x86/configure_fingerprint.bin index fe4a425..85f5535 100644 --- a/android/app/.cxx/Debug/626b5o2n/x86/configure_fingerprint.bin +++ b/android/app/.cxx/Debug/626b5o2n/x86/configure_fingerprint.bin @@ -2,27 +2,27 @@ C/C++ Structured LogO M KC:\dev\flutter\packages\flutter_tools\gradle\src\main\groovy\CMakeLists.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ݈2 2{ +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  2 2{ y -wD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\additional_project_files.txt  ݈2  2x +wD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\additional_project_files.txt  2  2x v -tD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\android_gradle_build.json  ݈2 2} +tD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\android_gradle_build.json  2 2} { -yD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\android_gradle_build_mini.json  ݈2 2j +yD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\android_gradle_build_mini.json  2 2j h -fD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\build.ninja  ݈2 2n +fD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\build.ninja  2 2n l -jD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\build.ninja.txt  ݈2s +jD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\build.ninja.txt  2s q -oD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\build_file_index.txt  ݈2 K 2t +oD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\build_file_index.txt  2 K 2t r -pD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\compile_commands.json  ݈2 x +pD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\compile_commands.json  ɀ2 x v -tD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\compile_commands.json.bin  ݈2 +tD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\compile_commands.json.bin  ɀ2 ~ | -zD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\metadata_generation_command.txt  ݈2  2q +zD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\metadata_generation_command.txt  ɀ2  2q o -mD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\prefab_config.json  ݈2  ( 2v +mD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\prefab_config.json  ɀ2  ( 2v t -rD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\symbol_folder_index.txt  ݈2  i 2 \ No newline at end of file +rD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86\symbol_folder_index.txt  2  i 2 \ No newline at end of file diff --git a/android/app/.cxx/Debug/626b5o2n/x86_64/configure_fingerprint.bin b/android/app/.cxx/Debug/626b5o2n/x86_64/configure_fingerprint.bin index abd7eab..a02f559 100644 --- a/android/app/.cxx/Debug/626b5o2n/x86_64/configure_fingerprint.bin +++ b/android/app/.cxx/Debug/626b5o2n/x86_64/configure_fingerprint.bin @@ -2,27 +2,27 @@ C/C++ Structured LogO M KC:\dev\flutter\packages\flutter_tools\gradle\src\main\groovy\CMakeLists.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ވ2 2~ +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  2 2~ | -zD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\additional_project_files.txt  ވ2  2{ +zD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\additional_project_files.txt  2  2{ y -wD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\android_gradle_build.json  ވ2 2 +wD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\android_gradle_build.json  2 2 ~ -|D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\android_gradle_build_mini.json  ވ2 2m +|D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\android_gradle_build_mini.json  2 2m k -iD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\build.ninja  ވ2 2q +iD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\build.ninja  2 2q o -mD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\build.ninja.txt  ވ2v +mD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\build.ninja.txt  2v t -rD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\build_file_index.txt  ވ2 K 2w +rD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\build_file_index.txt  2 K 2w u -sD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\compile_commands.json  ވ2 { +sD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\compile_commands.json  2 { y -wD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\compile_commands.json.bin  ވ2 +wD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\compile_commands.json.bin  2   -}D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\metadata_generation_command.txt  ވ2  2t +}D:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\metadata_generation_command.txt  2  2t r -pD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\prefab_config.json  ވ2  ( 2y +pD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\prefab_config.json  2  ( 2y w -uD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\symbol_folder_index.txt  ވ2  l 2 \ No newline at end of file +uD:\KULIAH\Matkul\SKRIPSI\penyaluran_app\penyaluran_app\android\app\.cxx\Debug\626b5o2n\x86_64\symbol_folder_index.txt  2  l 2 \ No newline at end of file diff --git a/lib/app/modules/penyaluran/detail_penyaluran_page.dart b/lib/app/modules/penyaluran/detail_penyaluran_page.dart index a4aa846..f89ca47 100644 --- a/lib/app/modules/penyaluran/detail_penyaluran_page.dart +++ b/lib/app/modules/penyaluran/detail_penyaluran_page.dart @@ -3,15 +3,12 @@ import 'package:get/get.dart'; import 'package:penyaluran_app/app/data/models/penerima_penyaluran_model.dart'; import 'package:penyaluran_app/app/modules/penyaluran/detail_penyaluran_controller.dart'; import 'package:penyaluran_app/app/theme/app_theme.dart'; -import 'package:image_picker/image_picker.dart'; import 'package:penyaluran_app/app/modules/penyaluran/konfirmasi_penerima_page.dart'; -import 'package:penyaluran_app/app/utils/date_formatter.dart'; -import 'package:penyaluran_app/app/data/models/penyaluran_bantuan_model.dart'; +import 'package:penyaluran_app/app/utils/date_time_helper.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; class DetailPenyaluranPage extends StatelessWidget { final controller = Get.put(DetailPenyaluranController()); - final ImagePicker _picker = ImagePicker(); final searchController = TextEditingController(); final RxString searchQuery = ''.obs; final RxString statusFilter = 'SEMUA'.obs; @@ -65,16 +62,14 @@ class DetailPenyaluranPage extends StatelessWidget { children: [ _buildInfoCard(context), const SizedBox(height: 16), - _buildPenerimaPenyaluranSection(context), - const SizedBox(height: 24), - // Menampilkan section alasan pembatalan jika status BATALTERLAKSANA if (controller.penyaluran.value?.status?.toUpperCase() == 'BATALTERLAKSANA' && controller.penyaluran.value?.alasanPembatalan != null && controller.penyaluran.value!.alasanPembatalan!.isNotEmpty) _buildPembatalanSection(context), + const SizedBox(height: 16), + _buildPenerimaPenyaluranSection(context), const SizedBox(height: 24), - // Tombol aksi akan ditampilkan di bottomNavigationBar ], ), ), @@ -161,7 +156,7 @@ class DetailPenyaluranPage extends StatelessWidget { _buildInfoRow( 'Tanggal', penyaluran.tanggalPenyaluran != null - ? DateFormatter.formatDateTime( + ? DateTimeHelper.formatDateTime( penyaluran.tanggalPenyaluran!) : 'Belum dijadwalkan'), // Tampilkan tanggal selesai jika status TERLAKSANA atau BATALTERLAKSANA @@ -170,7 +165,8 @@ class DetailPenyaluranPage extends StatelessWidget { _buildInfoRow( 'Tanggal Selesai', penyaluran.tanggalSelesai != null - ? DateFormatter.formatDateTime(penyaluran.tanggalSelesai!) + ? DateTimeHelper.formatDateTime( + penyaluran.tanggalSelesai!) : '-'), _buildInfoRow( 'Jumlah Penerima', '${penyaluran.jumlahPenerima ?? 0} orang'), @@ -201,72 +197,6 @@ class DetailPenyaluranPage extends StatelessWidget { ), ), ], - - // Alasan penolakan jika ada - if (penyaluran.alasanPembatalan != null && - penyaluran.alasanPembatalan!.isNotEmpty) ...[ - const Divider(height: 24), - if (penyaluran.status?.toUpperCase() == 'BATALTERLAKSANA') ...[ - Container( - width: double.infinity, - padding: const EdgeInsets.all(12), - decoration: BoxDecoration( - color: AppTheme.errorColor.withOpacity(0.1), - borderRadius: BorderRadius.circular(8), - border: Border.all( - color: AppTheme.errorColor.withOpacity(0.5), - width: 1, - ), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon( - Icons.cancel_outlined, - color: AppTheme.errorColor, - size: 20, - ), - const SizedBox(width: 8), - Text( - 'Alasan Pembatalan:', - style: TextStyle( - fontWeight: FontWeight.bold, - color: AppTheme.errorColor, - fontSize: 16, - ), - ), - ], - ), - const SizedBox(height: 8), - Text( - penyaluran.alasanPembatalan!, - style: TextStyle( - color: Colors.red[700], - ), - ), - ], - ), - ), - ] else ...[ - Text( - 'Alasan Pembatalan:', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.red[700], - ), - ), - const SizedBox(height: 4), - Text( - penyaluran.alasanPembatalan!, - style: TextStyle( - color: Colors.red[700], - fontStyle: FontStyle.italic, - ), - ), - ], - ], ], ), ), @@ -1339,7 +1269,7 @@ class DetailPenyaluranPage extends StatelessWidget { if (penerima.tanggalPenerimaan != null) _buildInfoRow( 'Tanggal Penerimaan', - DateFormatter.formatDate( + DateTimeHelper.formatDate( penerima.tanggalPenerimaan!)), if (penerima.jumlahBantuan != null) _buildInfoRow('Jumlah Bantuan', @@ -1440,26 +1370,25 @@ class DetailPenyaluranPage extends StatelessWidget { // Tombol tutup SizedBox( - width: double.infinity, - child: ElevatedButton( - onPressed: () => Navigator.pop(context), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.grey.shade200, - foregroundColor: Colors.black87, - padding: const EdgeInsets.symmetric(vertical: 12), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), + width: double.infinity, + child: ElevatedButton( + onPressed: () => Navigator.pop(context), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.grey.shade200, + foregroundColor: Colors.black87, + padding: const EdgeInsets.symmetric(vertical: 12), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), ), - ), - child: const Text( - 'Tutup', - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold, + child: const Text( + 'Tutup', + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + ), ), - ), - ), - ), + )), ], ), ), @@ -1532,7 +1461,7 @@ class DetailPenyaluranPage extends StatelessWidget { _buildInfoRow('Status', 'Batal Terlaksana'), if (penyaluran.tanggalSelesai != null) _buildInfoRow('Tanggal Pembatalan', - DateFormatter.formatDateTime(penyaluran.tanggalSelesai!)), + DateTimeHelper.formatDateTime(penyaluran.tanggalSelesai!)), const SizedBox(height: 8), const Text( 'Alasan Pembatalan:', diff --git a/lib/app/modules/penyaluran/konfirmasi_penerima_page.dart b/lib/app/modules/penyaluran/konfirmasi_penerima_page.dart index 55a8542..8f1df96 100644 --- a/lib/app/modules/penyaluran/konfirmasi_penerima_page.dart +++ b/lib/app/modules/penyaluran/konfirmasi_penerima_page.dart @@ -9,7 +9,7 @@ import 'package:signature/signature.dart'; import 'dart:io'; import 'dart:typed_data'; import 'dart:ui' as ui; -import 'package:penyaluran_app/app/utils/date_formatter.dart'; +import 'package:penyaluran_app/app/utils/date_time_helper.dart'; class KonfirmasiPenerimaPage extends StatefulWidget { final PenerimaPenyaluranModel penerima; @@ -187,7 +187,7 @@ class _KonfirmasiPenerimaPageState extends State { 'Tempat, Tanggal Lahir', warga?['tempat_lahir'] != null && warga?['tanggal_lahir'] != null - ? '${warga!['tempat_lahir']}, ${DateFormatter.formatDate(DateTime.parse(warga['tanggal_lahir']), format: 'd MMMM yyyy')}' + ? '${warga!['tempat_lahir']}, ${DateTimeHelper.formatDate(DateTime.parse(warga['tanggal_lahir']), format: 'd MMMM yyyy')}' : 'Bogor, 2 Juni 1990'), const Divider(), @@ -223,9 +223,9 @@ class _KonfirmasiPenerimaPageState extends State { String tanggalWaktuPenyaluran = ''; if (widget.tanggalPenyaluran != null) { - final tanggal = DateFormatter.formatDate(widget.tanggalPenyaluran!); - final waktuMulai = DateFormatter.formatTime(widget.tanggalPenyaluran!); - final waktuSelesai = DateFormatter.formatTime( + final tanggal = DateTimeHelper.formatDate(widget.tanggalPenyaluran!); + final waktuMulai = DateTimeHelper.formatTime(widget.tanggalPenyaluran!); + final waktuSelesai = DateTimeHelper.formatTime( widget.tanggalPenyaluran!.add(const Duration(hours: 1))); tanggalWaktuPenyaluran = '$tanggal $waktuMulai-$waktuSelesai'; } else { diff --git a/lib/app/modules/petugas_desa/components/calendar_view_widget.dart b/lib/app/modules/petugas_desa/components/calendar_view_widget.dart index 0838906..eb66dd6 100644 --- a/lib/app/modules/petugas_desa/components/calendar_view_widget.dart +++ b/lib/app/modules/petugas_desa/components/calendar_view_widget.dart @@ -42,86 +42,90 @@ class CalendarViewWidget extends StatelessWidget { ), ), ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.65, - child: Obx(() { - return SfCalendar( - view: CalendarView.month, - dataSource: _getCalendarDataSource(), - timeZone: 'Asia/Jakarta', - monthViewSettings: MonthViewSettings( - appointmentDisplayMode: MonthAppointmentDisplayMode.indicator, - showAgenda: true, - agendaViewHeight: MediaQuery.of(context).size.height * 0.3, - agendaItemHeight: 60, - dayFormat: 'EEE', - numberOfWeeksInView: 6, - appointmentDisplayCount: 3, - monthCellStyle: MonthCellStyle( - textStyle: const TextStyle( - fontSize: 12, - color: Colors.black87, + Padding( + padding: const EdgeInsets.all(8.0), + child: SizedBox( + height: MediaQuery.of(context).size.height * 0.65, + child: Obx(() { + return SfCalendar( + view: CalendarView.month, + dataSource: _getCalendarDataSource(), + timeZone: 'Asia/Jakarta', + monthViewSettings: MonthViewSettings( + appointmentDisplayMode: + MonthAppointmentDisplayMode.indicator, + showAgenda: true, + agendaViewHeight: MediaQuery.of(context).size.height * 0.3, + agendaItemHeight: 60, + dayFormat: 'EEE', + numberOfWeeksInView: 6, + appointmentDisplayCount: 3, + monthCellStyle: MonthCellStyle( + textStyle: const TextStyle( + fontSize: 12, + color: Colors.black87, + ), + trailingDatesTextStyle: TextStyle( + fontSize: 12, + color: Colors.grey.withOpacity(0.7), + ), + leadingDatesTextStyle: TextStyle( + fontSize: 12, + color: Colors.grey.withOpacity(0.7), + ), ), - trailingDatesTextStyle: TextStyle( - fontSize: 12, - color: Colors.grey.withOpacity(0.7), - ), - leadingDatesTextStyle: TextStyle( - fontSize: 12, - color: Colors.grey.withOpacity(0.7), + agendaStyle: const AgendaStyle( + backgroundColor: Colors.white, + appointmentTextStyle: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w500, + color: Colors.white, + ), + dateTextStyle: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w500, + color: AppTheme.primaryColor, + ), + dayTextStyle: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w500, + color: AppTheme.primaryColor, + ), ), ), - agendaStyle: const AgendaStyle( + cellBorderColor: Colors.grey.withOpacity(0.2), + todayHighlightColor: AppTheme.primaryColor, + selectionDecoration: BoxDecoration( + color: Colors.transparent, + border: Border.all(color: AppTheme.primaryColor, width: 2), + borderRadius: const BorderRadius.all(Radius.circular(4)), + shape: BoxShape.rectangle, + ), + headerStyle: const CalendarHeaderStyle( backgroundColor: Colors.white, - appointmentTextStyle: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w500, - color: Colors.white, - ), - dateTextStyle: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w500, - color: AppTheme.primaryColor, - ), - dayTextStyle: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w500, + textStyle: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, color: AppTheme.primaryColor, ), ), - ), - cellBorderColor: Colors.grey.withOpacity(0.2), - todayHighlightColor: AppTheme.primaryColor, - selectionDecoration: BoxDecoration( - color: Colors.transparent, - border: Border.all(color: AppTheme.primaryColor, width: 2), - borderRadius: const BorderRadius.all(Radius.circular(4)), - shape: BoxShape.rectangle, - ), - headerStyle: const CalendarHeaderStyle( - backgroundColor: Colors.white, - textStyle: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - color: AppTheme.primaryColor, - ), - ), - monthCellBuilder: _monthCellBuilder, - onTap: (CalendarTapDetails details) { - if (details.targetElement == CalendarElement.appointment) { - final Appointment appointment = details.appointments![0]; - _showAppointmentDetails(context, appointment); - } else if (details.targetElement == - CalendarElement.calendarCell) { - // if (appointmentsOnDay.isNotEmpty) { - // _showAppointmentsOnDay( - // context, details.date!, appointmentsOnDay); - // } - } - }, - appointmentBuilder: _appointmentBuilder, - ); - }), + monthCellBuilder: _monthCellBuilder, + onTap: (CalendarTapDetails details) { + if (details.targetElement == CalendarElement.appointment) { + final Appointment appointment = details.appointments![0]; + _showAppointmentDetails(context, appointment); + } else if (details.targetElement == + CalendarElement.calendarCell) { + // if (appointmentsOnDay.isNotEmpty) { + // _showAppointmentsOnDay( + // context, details.date!, appointmentsOnDay); + // } + } + }, + appointmentBuilder: _appointmentBuilder, + ); + }), + ), ), ], ), diff --git a/lib/app/modules/petugas_desa/controllers/penerima_controller.dart b/lib/app/modules/petugas_desa/controllers/penerima_controller.dart index 4371518..cbfeb8a 100644 --- a/lib/app/modules/petugas_desa/controllers/penerima_controller.dart +++ b/lib/app/modules/petugas_desa/controllers/penerima_controller.dart @@ -1,6 +1,6 @@ import 'package:get/get.dart'; import 'package:flutter/material.dart'; -import 'package:penyaluran_app/app/utils/date_formatter.dart'; +import 'package:penyaluran_app/app/utils/date_time_helper.dart'; class PenerimaController extends GetxController { final RxList> daftarPenerima = @@ -190,7 +190,7 @@ class PenerimaController extends GetxController { ); if (picked != null) { - tanggalPenyaluran.value = DateFormatter.formatDate(picked); + tanggalPenyaluran.value = DateTimeHelper.formatDate(picked); } } diff --git a/lib/app/modules/petugas_desa/views/detail_donatur_view.dart b/lib/app/modules/petugas_desa/views/detail_donatur_view.dart index 7bd039a..0c28326 100644 --- a/lib/app/modules/petugas_desa/views/detail_donatur_view.dart +++ b/lib/app/modules/petugas_desa/views/detail_donatur_view.dart @@ -5,7 +5,7 @@ import 'package:penyaluran_app/app/theme/app_theme.dart'; 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/detail_penitipan_dialog.dart'; -import 'package:penyaluran_app/app/utils/date_formatter.dart'; +import 'package:penyaluran_app/app/utils/date_time_helper.dart'; class DetailDonaturView extends GetView { const DetailDonaturView({super.key}); @@ -207,7 +207,7 @@ class DetailDonaturView extends GetView { Icons.calendar_today, 'Terdaftar Sejak', donatur.createdAt != null - ? DateFormatter.formatDate(donatur.createdAt!) + ? DateTimeHelper.formatDate(donatur.createdAt!) : 'Tidak diketahui', ), ], @@ -433,7 +433,7 @@ class DetailDonaturView extends GetView { Widget _buildDonasiItem(PenitipanBantuanModel penitipan) { final isUang = penitipan.isUang == true; final tanggal = penitipan.createdAt != null - ? DateFormatter.formatDate(penitipan.createdAt!, format: 'dd MMM yyyy') + ? DateTimeHelper.formatDate(penitipan.createdAt!, format: 'dd MMM yyyy') : 'Tanggal tidak diketahui'; String nilaiDonasi = ''; diff --git a/lib/app/modules/petugas_desa/views/detail_penerima_view.dart b/lib/app/modules/petugas_desa/views/detail_penerima_view.dart index 20d54ea..ba55d19 100644 --- a/lib/app/modules/petugas_desa/views/detail_penerima_view.dart +++ b/lib/app/modules/petugas_desa/views/detail_penerima_view.dart @@ -55,7 +55,7 @@ class DetailPenerimaView extends GetView { ], ), ), - bottomNavigationBar: _buildBottomButtons(penerima), + // bottomNavigationBar: _buildBottomButtons(penerima), ); }); } @@ -345,84 +345,4 @@ class DetailPenerimaView extends GetView { ), ); } - - Widget _buildBottomButtons(Map penerima) { - // Jika status sudah selesai, tidak perlu menampilkan tombol - if (penerima['status'] == 'Selesai') { - return Container( - padding: const EdgeInsets.all(16), - child: ElevatedButton.icon( - onPressed: () { - // Implementasi lihat riwayat penyaluran - }, - icon: const Icon(Icons.history), - label: const Text('Lihat Riwayat Penyaluran'), - style: ElevatedButton.styleFrom( - backgroundColor: AppTheme.primaryColor, - foregroundColor: Colors.white, - padding: const EdgeInsets.symmetric(vertical: 12), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), - ), - ), - ); - } - - // Jika status belum disalurkan, tampilkan tombol jadwalkan - if (penerima['status'] == 'Belum disalurkan') { - return Container( - padding: const EdgeInsets.all(16), - child: Row( - children: [ - Expanded( - child: ElevatedButton.icon( - onPressed: () { - // Implementasi jadwalkan penyaluran - }, - icon: const Icon(Icons.event), - label: const Text('Jadwalkan Penyaluran'), - style: ElevatedButton.styleFrom( - backgroundColor: AppTheme.primaryColor, - foregroundColor: Colors.white, - padding: const EdgeInsets.symmetric(vertical: 12), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), - ), - ), - ), - ], - ), - ); - } - - // Jika status terjadwal, tampilkan tombol konfirmasi penyaluran - return Container( - padding: const EdgeInsets.all(16), - child: Row( - children: [ - Expanded( - child: ElevatedButton.icon( - onPressed: () { - // Navigasi ke halaman konfirmasi penerima - Get.toNamed('/daftar-penerima/konfirmasi', - arguments: penerima['id']); - }, - icon: const Icon(Icons.check_circle), - label: const Text('Konfirmasi Penyaluran'), - style: ElevatedButton.styleFrom( - backgroundColor: AppTheme.successColor, - foregroundColor: Colors.white, - padding: const EdgeInsets.symmetric(vertical: 12), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), - ), - ), - ), - ], - ), - ); - } } diff --git a/lib/app/modules/petugas_desa/views/penitipan_view.dart b/lib/app/modules/petugas_desa/views/penitipan_view.dart index 86d588a..78ca004 100644 --- a/lib/app/modules/petugas_desa/views/penitipan_view.dart +++ b/lib/app/modules/petugas_desa/views/penitipan_view.dart @@ -4,7 +4,7 @@ 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/modules/petugas_desa/controllers/penitipan_bantuan_controller.dart'; import 'package:penyaluran_app/app/theme/app_theme.dart'; -import 'package:penyaluran_app/app/utils/date_formatter.dart'; +import 'package:penyaluran_app/app/utils/date_time_helper.dart'; import 'package:penyaluran_app/app/widgets/detail_penitipan_dialog.dart'; import 'dart:io'; @@ -78,7 +78,7 @@ class PenitipanView extends GetView { context, icon: Icons.pending_actions, title: 'Menunggu', - value: DateFormatter.formatNumber( + value: DateTimeHelper.formatNumber( controller.jumlahMenunggu.value), color: Colors.orange, ), @@ -88,7 +88,7 @@ class PenitipanView extends GetView { context, icon: Icons.check_circle, title: 'Terverifikasi', - value: DateFormatter.formatNumber( + value: DateTimeHelper.formatNumber( controller.jumlahTerverifikasi.value), color: Colors.green, ), @@ -98,7 +98,7 @@ class PenitipanView extends GetView { context, icon: Icons.cancel, title: 'Ditolak', - value: DateFormatter.formatNumber( + value: DateTimeHelper.formatNumber( controller.jumlahDitolak.value), color: Colors.red, ), @@ -225,7 +225,7 @@ class PenitipanView extends GetView { ), ), Text( - '${DateFormatter.formatNumber(filteredList.length)} item', + '${DateTimeHelper.formatNumber(filteredList.length)} item', style: Theme.of(context).textTheme.bodyMedium?.copyWith( color: Colors.grey, ), @@ -385,8 +385,8 @@ class PenitipanView extends GetView { isUang ? Icons.account_balance_wallet : Icons.inventory, label: 'Jumlah', value: isUang - ? 'Rp ${DateFormatter.formatNumber(item.jumlah)}' - : '${DateFormatter.formatNumber(item.jumlah)} $kategoriSatuan', + ? 'Rp ${DateTimeHelper.formatNumber(item.jumlah)}' + : '${DateTimeHelper.formatNumber(item.jumlah)} $kategoriSatuan', ), ), ], @@ -400,7 +400,7 @@ class PenitipanView extends GetView { context, icon: Icons.calendar_today, label: 'Tanggal Dibuat', - value: DateFormatter.formatDateTime(item.createdAt, + value: DateTimeHelper.formatDateTime(item.createdAt, defaultValue: 'Tidak ada tanggal'), ), ), @@ -1523,7 +1523,7 @@ class PenitipanView extends GetView { Widget _buildLastUpdateInfo(BuildContext context) { return Obx(() { final lastUpdate = controller.lastUpdateTime.value; - final formattedDate = DateFormatter.formatDateTimeWithHour(lastUpdate); + final formattedDate = DateTimeHelper.formatDateTimeWithHour(lastUpdate); return Padding( padding: const EdgeInsets.only(top: 8.0), diff --git a/lib/app/modules/petugas_desa/views/penyaluran_view.dart b/lib/app/modules/petugas_desa/views/penyaluran_view.dart index cb61ecd..f24c6a3 100644 --- a/lib/app/modules/petugas_desa/views/penyaluran_view.dart +++ b/lib/app/modules/petugas_desa/views/penyaluran_view.dart @@ -3,7 +3,6 @@ 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/modules/petugas_desa/components/jadwal_section_widget.dart'; -import 'package:penyaluran_app/app/modules/petugas_desa/components/permintaan_penjadwalan_summary_widget.dart'; import 'package:penyaluran_app/app/modules/petugas_desa/components/calendar_view_widget.dart'; import 'package:penyaluran_app/app/modules/petugas_desa/views/tambah_penyaluran_view.dart'; @@ -117,18 +116,7 @@ class PenyaluranView extends GetView { ); } - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Ringkasan jadwal - _buildJadwalSummary(Get.context!), - - const SizedBox(height: 20), - - // Kalender Penyaluran Bulan Ini - CalendarViewWidget(controller: controller), - ], - ); + return CalendarViewWidget(controller: controller); }), ), ), diff --git a/lib/app/modules/petugas_desa/views/riwayat_penitipan_view.dart b/lib/app/modules/petugas_desa/views/riwayat_penitipan_view.dart index 06ca910..b17e109 100644 --- a/lib/app/modules/petugas_desa/views/riwayat_penitipan_view.dart +++ b/lib/app/modules/petugas_desa/views/riwayat_penitipan_view.dart @@ -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_formatter.dart'; +import 'package:penyaluran_app/app/utils/date_time_helper.dart'; import 'package:penyaluran_app/app/theme/app_theme.dart'; class RiwayatPenitipanView extends GetView { @@ -47,7 +47,7 @@ class RiwayatPenitipanView extends GetView { final kategoriNama = item.kategoriBantuan?.nama?.toLowerCase() ?? ''; final deskripsi = item.deskripsi?.toLowerCase() ?? ''; final tanggal = - DateFormatter.formatDateTime(item.tanggalPenitipan).toLowerCase(); + DateTimeHelper.formatDateTime(item.tanggalPenitipan).toLowerCase(); return donaturNama.contains(searchText) || kategoriNama.contains(searchText) || @@ -99,7 +99,7 @@ class RiwayatPenitipanView extends GetView { ), ), Text( - '${DateFormatter.formatNumber(filteredList.length)} item', + '${DateTimeHelper.formatNumber(filteredList.length)} item', style: Theme.of(context).textTheme.bodyMedium?.copyWith( color: Colors.grey, @@ -113,7 +113,7 @@ class RiwayatPenitipanView extends GetView { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - 'Total: ${DateFormatter.formatNumber(filteredList.length)} item', + 'Total: ${DateTimeHelper.formatNumber(filteredList.length)} item', style: Theme.of(context).textTheme.bodyMedium?.copyWith( color: Colors.grey, @@ -126,7 +126,7 @@ class RiwayatPenitipanView extends GetView { size: 16, color: Colors.grey[600]), const SizedBox(width: 4), Text( - 'Update: ${DateFormatter.formatDateTimeWithHour(controller.lastUpdateTime.value)}', + 'Update: ${DateTimeHelper.formatDateTimeWithHour(controller.lastUpdateTime.value)}', style: TextStyle( fontSize: 12, color: Colors.grey[600], @@ -284,8 +284,8 @@ class RiwayatPenitipanView extends GetView { isUang ? Icons.account_balance_wallet : Icons.inventory, label: 'Jumlah', value: isUang - ? 'Rp ${DateFormatter.formatNumber(item.jumlah)}' - : '${DateFormatter.formatNumber(item.jumlah)} $kategoriSatuan', + ? 'Rp ${DateTimeHelper.formatNumber(item.jumlah)}' + : '${DateTimeHelper.formatNumber(item.jumlah)} $kategoriSatuan', ), ), ], @@ -300,7 +300,7 @@ class RiwayatPenitipanView extends GetView { label: item.status == 'TERVERIFIKASI' ? 'Tanggal Verifikasi' : 'Tanggal Penolakan', - value: DateFormatter.formatDateTime( + value: DateTimeHelper.formatDateTime( item.status == 'TERVERIFIKASI' ? item.tanggalVerifikasi : item.updatedAt, @@ -414,20 +414,20 @@ class RiwayatPenitipanView extends GetView { _buildDetailItem( 'Jumlah', isUang - ? 'Rp ${DateFormatter.formatNumber(item.jumlah)}' - : '${DateFormatter.formatNumber(item.jumlah)} $kategoriSatuan'), + ? 'Rp ${DateTimeHelper.formatNumber(item.jumlah)}' + : '${DateTimeHelper.formatNumber(item.jumlah)} $kategoriSatuan'), if (isUang) _buildDetailItem('Jenis Bantuan', 'Uang (Rupiah)'), _buildDetailItem( 'Deskripsi', item.deskripsi ?? 'Tidak ada deskripsi'), _buildDetailItem( 'Tanggal Penitipan', - DateFormatter.formatDateTime(item.tanggalPenitipan, + DateTimeHelper.formatDateTime(item.tanggalPenitipan, defaultValue: 'Tidak ada tanggal'), ), if (item.tanggalVerifikasi != null) _buildDetailItem( 'Tanggal Verifikasi', - DateFormatter.formatDateTime(item.tanggalVerifikasi), + DateTimeHelper.formatDateTime(item.tanggalVerifikasi), ), if (item.status == 'TERVERIFIKASI' && item.petugasDesaId != null) _buildDetailItem( @@ -435,7 +435,7 @@ class RiwayatPenitipanView extends GetView { controller.getPetugasDesaNama(item.petugasDesaId), ), _buildDetailItem('Tanggal Dibuat', - DateFormatter.formatDateTime(item.createdAt)), + DateTimeHelper.formatDateTime(item.createdAt)), if (item.alasanPenolakan != null && item.alasanPenolakan!.isNotEmpty) _buildDetailItem('Alasan Penolakan', item.alasanPenolakan!), diff --git a/lib/app/modules/petugas_desa/views/riwayat_penyaluran_view.dart b/lib/app/modules/petugas_desa/views/riwayat_penyaluran_view.dart index fab2451..af5dc15 100644 --- a/lib/app/modules/petugas_desa/views/riwayat_penyaluran_view.dart +++ b/lib/app/modules/petugas_desa/views/riwayat_penyaluran_view.dart @@ -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_formatter.dart'; +import 'package:penyaluran_app/app/utils/date_time_helper.dart'; import 'package:penyaluran_app/app/theme/app_theme.dart'; class RiwayatPenyaluranView extends GetView { @@ -52,7 +52,7 @@ class RiwayatPenyaluranView extends GetView { .getKategoriBantuanName(item.kategoriBantuanId) .toLowerCase(); final tanggal = - DateFormatter.formatDateTime(item.tanggalPenyaluran).toLowerCase(); + DateTimeHelper.formatDateTime(item.tanggalPenyaluran).toLowerCase(); return nama.contains(searchText) || deskripsi.contains(searchText) || @@ -105,7 +105,7 @@ class RiwayatPenyaluranView extends GetView { ), ), Text( - '${DateFormatter.formatNumber(filteredList.length)} item', + '${DateTimeHelper.formatNumber(filteredList.length)} item', style: Theme.of(context).textTheme.bodyMedium?.copyWith( color: Colors.grey, @@ -119,7 +119,7 @@ class RiwayatPenyaluranView extends GetView { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - 'Total: ${DateFormatter.formatNumber(filteredList.length)} item', + 'Total: ${DateTimeHelper.formatNumber(filteredList.length)} item', style: Theme.of(context).textTheme.bodyMedium?.copyWith( color: Colors.grey, @@ -132,7 +132,7 @@ class RiwayatPenyaluranView extends GetView { size: 16, color: Colors.grey[600]), const SizedBox(width: 4), Text( - 'Update: ${DateFormatter.formatDateTimeWithHour(DateTime.now())}', + 'Update: ${DateTimeHelper.formatDateTimeWithHour(DateTime.now())}', style: TextStyle( fontSize: 12, color: Colors.grey[600], @@ -305,8 +305,8 @@ class RiwayatPenyaluranView extends GetView { child: _buildInfoItem( Icons.event, 'Tanggal', - DateFormatter.formatDateTime(item.tanggalPenyaluran, - defaultValue: 'Tidak ada tanggal'), + DateTimeHelper.formatDateTime(item.tanggalPenyaluran, + format: 'dd MMM yyyy HH:mm'), Theme.of(context).textTheme, ), ), @@ -316,7 +316,7 @@ class RiwayatPenyaluranView extends GetView { _buildInfoItem( Icons.people_outline, 'Jumlah Penerima', - '${DateFormatter.formatNumber(item.jumlahPenerima ?? 0)} orang', + '${DateTimeHelper.formatNumber(item.jumlahPenerima ?? 0)} orang', Theme.of(context).textTheme, ), if (item.alasanPembatalan != null && diff --git a/lib/app/modules/petugas_desa/views/stok_bantuan_view.dart b/lib/app/modules/petugas_desa/views/stok_bantuan_view.dart index 2cfe998..8eb33ec 100644 --- a/lib/app/modules/petugas_desa/views/stok_bantuan_view.dart +++ b/lib/app/modules/petugas_desa/views/stok_bantuan_view.dart @@ -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_formatter.dart'; +import 'package:penyaluran_app/app/utils/date_time_helper.dart'; class StokBantuanView extends GetView { const StokBantuanView({super.key}); @@ -154,7 +154,7 @@ class StokBantuanView extends GetView { ), ), Text( - 'Rp ${DateFormatter.formatNumber(controller.totalDanaBantuan.value)}', + 'Rp ${DateTimeHelper.formatNumber(controller.totalDanaBantuan.value)}', style: Theme.of(context).textTheme.titleLarge?.copyWith( fontWeight: FontWeight.bold, @@ -417,8 +417,8 @@ class StokBantuanView extends GetView { : Icons.inventory, label: item.isUang == true ? 'Total Dana' : 'Total Stok', value: item.isUang == true - ? 'Rp ${DateFormatter.formatNumber(item.totalStok)}' - : '${DateFormatter.formatNumber(item.totalStok)} ${item.satuan ?? ''}', + ? 'Rp ${DateTimeHelper.formatNumber(item.totalStok)}' + : '${DateTimeHelper.formatNumber(item.totalStok)} ${item.satuan ?? ''}', ), ), Expanded( @@ -426,7 +426,7 @@ class StokBantuanView extends GetView { context, icon: Icons.access_time, label: 'Terakhir Diperbarui', - value: DateFormatter.formatDateTime(item.updatedAt), + value: DateTimeHelper.formatDateTime(item.updatedAt), ), ), ], @@ -873,8 +873,8 @@ class StokBantuanView extends GetView { const SizedBox(width: 8), Text( isUang - ? 'Rp ${DateFormatter.formatNumber(stok.totalStok)}' - : '${DateFormatter.formatNumber(stok.totalStok)} ${stok.satuan ?? ''}', + ? 'Rp ${DateTimeHelper.formatNumber(stok.totalStok)}' + : '${DateTimeHelper.formatNumber(stok.totalStok)} ${stok.satuan ?? ''}', style: TextStyle(fontWeight: FontWeight.bold), ), ], @@ -1064,8 +1064,8 @@ class StokBantuanView extends GetView { SizedBox(width: 4), Text( stok.isUang == true - ? 'Rp ${DateFormatter.formatNumber(stok.totalStok)}' - : '${DateFormatter.formatNumber(stok.totalStok)} ${stok.satuan ?? ''}', + ? 'Rp ${DateTimeHelper.formatNumber(stok.totalStok)}' + : '${DateTimeHelper.formatNumber(stok.totalStok)} ${stok.satuan ?? ''}', style: TextStyle(fontWeight: FontWeight.bold), ), ], @@ -1129,7 +1129,7 @@ class StokBantuanView extends GetView { Widget _buildLastUpdateInfo(BuildContext context) { return Obx(() { final lastUpdate = controller.lastUpdateTime.value; - final formattedDate = DateFormatter.formatDateTimeWithHour(lastUpdate); + final formattedDate = DateTimeHelper.formatDateTimeWithHour(lastUpdate); return Padding( padding: const EdgeInsets.only(top: 8.0), diff --git a/lib/app/modules/petugas_desa/views/tambah_penyaluran_view.dart b/lib/app/modules/petugas_desa/views/tambah_penyaluran_view.dart index 88a2b85..3ea5ffc 100644 --- a/lib/app/modules/petugas_desa/views/tambah_penyaluran_view.dart +++ b/lib/app/modules/petugas_desa/views/tambah_penyaluran_view.dart @@ -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_formatter.dart'; +import 'package:penyaluran_app/app/utils/date_time_helper.dart'; class TambahPenyaluranView extends GetView { const TambahPenyaluranView({super.key}); @@ -327,7 +327,7 @@ class TambahPenyaluranView extends GetView { if (pickedDate != null) { selectedDate.value = pickedDate; tanggalPenyaluranController.text = - DateFormatter.formatDate(pickedDate); + DateTimeHelper.formatDate(pickedDate); } }, validator: (value) { diff --git a/lib/app/utils/date_formatter.dart b/lib/app/utils/date_formatter.dart deleted file mode 100644 index 743232f..0000000 --- a/lib/app/utils/date_formatter.dart +++ /dev/null @@ -1,60 +0,0 @@ -import 'package:intl/intl.dart'; - -class DateFormatter { - static String formatDate(DateTime? date, - {String format = 'dd MMMM yyyy', - String locale = 'id_ID', - String defaultValue = '-'}) { - if (date == null) return defaultValue; - try { - return DateFormat(format, locale).format(date); - } catch (e) { - print('Error formatting date: $e'); - return date.toString().split(' ')[0]; // Fallback to basic format - } - } - - static String formatTime(DateTime? time, - {String format = 'HH:mm', - String locale = 'id_ID', - String defaultValue = '-'}) { - if (time == null) return defaultValue; - try { - return DateFormat(format, locale).format(time); - } catch (e) { - print('Error formatting time: $e'); - return time - .toString() - .split(' ')[1] - .substring(0, 5); // Fallback to basic format - } - } - - static String formatDateTime(DateTime? dateTime, - {String format = 'dd MMMM yyyy HH:mm', - String locale = 'id_ID', - String defaultValue = '-'}) { - if (dateTime == null) return defaultValue; - try { - return DateFormat(format, locale).format(dateTime); - } catch (e) { - print('Error formatting date time: $e'); - return dateTime.toString().split('.')[0]; // Fallback to basic format - } - } - - static String formatNumber(num? number, - {String locale = 'id_ID', String defaultValue = '0'}) { - if (number == null) return defaultValue; - try { - return NumberFormat("#,##0.##", locale).format(number); - } catch (e) { - print('Error formatting number: $e'); - return number.toString(); // Fallback to basic format - } - } - - static String formatDateTimeWithHour(DateTime dateTime) { - return DateFormat('dd MMMM yyyy HH:mm', 'id_ID').format(dateTime); - } -} diff --git a/lib/app/utils/date_time_helper.dart b/lib/app/utils/date_time_helper.dart index 011c685..f0810d3 100644 --- a/lib/app/utils/date_time_helper.dart +++ b/lib/app/utils/date_time_helper.dart @@ -1,5 +1,4 @@ import 'package:intl/intl.dart'; -import 'package:penyaluran_app/app/utils/date_formatter.dart'; class DateTimeHelper { /// Mengkonversi DateTime dari UTC ke timezone lokal @@ -8,31 +7,57 @@ class DateTimeHelper { } /// Format tanggal ke format Indonesia (dd MMM yyyy) - static String formatDate(DateTime? dateTime) { - if (dateTime == null) return 'Belum ditentukan'; + static String formatDate(DateTime? dateTime, + {String format = 'dd MMM yyyy', + String locale = 'id_ID', + String defaultValue = 'Belum ditentukan'}) { + if (dateTime == null) return defaultValue; // Pastikan tanggal dalam timezone lokal final localDateTime = toLocalDateTime(dateTime); - return DateFormatter.formatDate(localDateTime, format: 'dd MMM yyyy'); + try { + return DateFormat(format, locale).format(localDateTime); + } catch (e) { + print('Error formatting date: $e'); + return localDateTime.toString().split(' ')[0]; // Fallback to basic format + } } /// Format waktu ke format 24 jam (HH:mm) - static String formatTime(DateTime? dateTime) { - if (dateTime == null) return 'Belum ditentukan'; + static String formatTime(DateTime? dateTime, + {String format = 'HH:mm', + String locale = 'id_ID', + String defaultValue = 'Belum ditentukan'}) { + if (dateTime == null) return defaultValue; // Pastikan waktu dalam timezone lokal final localDateTime = toLocalDateTime(dateTime); - return DateFormatter.formatTime(localDateTime); + try { + return DateFormat(format, locale).format(localDateTime); + } catch (e) { + print('Error formatting time: $e'); + return localDateTime + .toString() + .split(' ')[1] + .substring(0, 5); // Fallback to basic format + } } /// Format tanggal dan waktu (dd MMM yyyy HH:mm) - static String formatDateTime(DateTime? dateTime) { - if (dateTime == null) return 'Belum ditentukan'; + static String formatDateTime(DateTime? dateTime, + {String format = 'dd MMM yyyy HH:mm', + String locale = 'id_ID', + String defaultValue = 'Belum ditentukan'}) { + if (dateTime == null) return defaultValue; // Pastikan tanggal dan waktu dalam timezone lokal final localDateTime = toLocalDateTime(dateTime); - return DateFormatter.formatDateTime(localDateTime, - format: 'dd MMM yyyy HH:mm'); + try { + return DateFormat(format, locale).format(localDateTime); + } catch (e) { + print('Error formatting date time: $e'); + return localDateTime.toString().split('.')[0]; // Fallback to basic format + } } /// Format tanggal lengkap dalam bahasa Indonesia (Senin, 01 Januari 2023) @@ -74,4 +99,23 @@ class DateTimeHelper { return '$hari, $tanggal $bulan $tahun'; } + + /// Format angka dengan pemisah ribuan + static String formatNumber(num? number, + {String locale = 'id_ID', String defaultValue = '0'}) { + if (number == null) return defaultValue; + try { + return NumberFormat("#,##0.##", locale).format(number); + } catch (e) { + print('Error formatting number: $e'); + return number.toString(); // Fallback to basic format + } + } + + /// Format tanggal dan waktu dengan jam (dd MMMM yyyy HH:mm) + static String formatDateTimeWithHour(DateTime? dateTime) { + if (dateTime == null) return 'Belum ditentukan'; + final localDateTime = toLocalDateTime(dateTime); + return DateFormat('dd MMMM yyyy HH:mm', 'id_ID').format(localDateTime); + } } diff --git a/lib/app/widgets/detail_penitipan_dialog.dart b/lib/app/widgets/detail_penitipan_dialog.dart index 706a550..8e2413d 100644 --- a/lib/app/widgets/detail_penitipan_dialog.dart +++ b/lib/app/widgets/detail_penitipan_dialog.dart @@ -1,7 +1,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/utils/date_formatter.dart'; +import 'package:penyaluran_app/app/utils/date_time_helper.dart'; /// Dialog untuk menampilkan detail penitipan bantuan /// @@ -54,20 +54,20 @@ class DetailPenitipanDialog { _buildDetailItem( 'Jumlah', isUang - ? 'Rp ${DateFormatter.formatNumber(item.jumlah)}' - : '${DateFormatter.formatNumber(item.jumlah)} $kategoriSatuan'), + ? 'Rp ${DateTimeHelper.formatNumber(item.jumlah)}' + : '${DateTimeHelper.formatNumber(item.jumlah)} $kategoriSatuan'), if (isUang) _buildDetailItem('Jenis Bantuan', 'Uang (Rupiah)'), _buildDetailItem( 'Deskripsi', item.deskripsi ?? 'Tidak ada deskripsi'), _buildDetailItem( 'Tanggal Penitipan', - DateFormatter.formatDateTime(item.tanggalPenitipan, + DateTimeHelper.formatDateTime(item.tanggalPenitipan, defaultValue: 'Tidak ada tanggal'), ), if (item.tanggalVerifikasi != null) _buildDetailItem( 'Tanggal Verifikasi', - DateFormatter.formatDateTime(item.tanggalVerifikasi), + DateTimeHelper.formatDateTime(item.tanggalVerifikasi), ), if (item.status == 'TERVERIFIKASI' && item.petugasDesaId != null) _buildDetailItem( @@ -75,7 +75,7 @@ class DetailPenitipanDialog { getPetugasDesaNama(item.petugasDesaId), ), _buildDetailItem('Tanggal Dibuat', - DateFormatter.formatDateTime(item.createdAt)), + DateTimeHelper.formatDateTime(item.createdAt)), if (item.alasanPenolakan != null && item.alasanPenolakan!.isNotEmpty) _buildDetailItem('Alasan Penolakan', item.alasanPenolakan!),