step 27 : fix homescreen, report timestamp, filter history transaksi
This commit is contained in:
@@ -464,6 +464,25 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
final FocusNode focusNodetglAkhir = useFocusNode();
|
||||
final tglAkhirHasFocus = useState(false);
|
||||
|
||||
String formatDateString(String inputDate) {
|
||||
try {
|
||||
// Parsing tanggal dari string input
|
||||
DateTime date =
|
||||
DateFormat('dd-MM-yyyy HH:mm:ss', 'id').parse(inputDate);
|
||||
|
||||
// Format tanggal ke '30 Des 2023'
|
||||
String formattedDate =
|
||||
DateFormat('dd MMM yyyy HH:mm:ss', 'id').format(date);
|
||||
|
||||
return formattedDate;
|
||||
} catch (e) {
|
||||
// Tangkap kesalahan jika format tanggal tidak sesuai
|
||||
print('Error parsing date: $e');
|
||||
// return 'Format Tanggal Salah';
|
||||
return inputDate;
|
||||
}
|
||||
}
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
child: Padding(
|
||||
@@ -736,6 +755,7 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
value: option,
|
||||
child: Text(
|
||||
option.categoryname ?? "",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Constant.body1(context: context)
|
||||
.copyWith(
|
||||
color: Constant.textBlack,
|
||||
@@ -875,13 +895,27 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
],
|
||||
),
|
||||
onPressed: () async {
|
||||
DateTime parsedDate =
|
||||
DateFormat('dd-MM-yyyy').parse(
|
||||
ctrlTglAwal.value.text.toString(),
|
||||
);
|
||||
String formattedDateAwal =
|
||||
DateFormat('yyyy-MM-dd').format(parsedDate);
|
||||
|
||||
DateTime parsedDateAkhir =
|
||||
DateFormat('dd-MM-yyyy').parse(
|
||||
ctrlTglAkhir.value.text.toString(),
|
||||
);
|
||||
String formattedDateAkhir = DateFormat('yyyy-MM-dd')
|
||||
.format(parsedDateAkhir);
|
||||
|
||||
M_CompanyID.value = await getCompanyID();
|
||||
ref
|
||||
.read(searchHistoryTransaksiProvider.notifier)
|
||||
.searchHistoryTransaksi(
|
||||
M_CompanyID.value,
|
||||
ctrlTglAwal.text,
|
||||
ctrlTglAkhir.text,
|
||||
formattedDateAwal,
|
||||
formattedDateAkhir,
|
||||
selectedListCategory.value.categoryid ?? "0",
|
||||
);
|
||||
},
|
||||
@@ -1080,7 +1114,27 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
// ),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 6),
|
||||
context: context, y: 10),
|
||||
),
|
||||
|
||||
// catatan
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
listSearchHistory.value[idx].note
|
||||
.toString(),
|
||||
style: Constant.body1(
|
||||
context: context)
|
||||
.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Constant.textBlack,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 10),
|
||||
),
|
||||
|
||||
if (listSearchHistory
|
||||
@@ -1308,70 +1362,32 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
// Row(
|
||||
// children: [
|
||||
// Container(
|
||||
// width: Constant.getActualXPhone(
|
||||
// context: context, x: 40),
|
||||
// height: Constant.getActualYPhone(
|
||||
// context: context,
|
||||
// y: 40,
|
||||
// ),
|
||||
// child: Image.asset(
|
||||
// "images/icon_delete.png",
|
||||
// // scale: 1,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: Constant.getActualYPhone(
|
||||
// context: context, y: 12),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: ElevatedButton(
|
||||
// style: ButtonStyle(
|
||||
// backgroundColor: MaterialStateColor
|
||||
// .resolveWith((st) => Constant
|
||||
// .pcBtnBackgroundColor),
|
||||
// shape:
|
||||
// MaterialStateProperty.all<
|
||||
// RoundedRectangleBorder>(
|
||||
// RoundedRectangleBorder(
|
||||
// borderRadius:
|
||||
// BorderRadius.circular(
|
||||
// 8),
|
||||
// side: BorderSide(
|
||||
// color: Constant
|
||||
// .pcBtnBackgroundColor,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// shadowColor:
|
||||
// MaterialStateProperty.all(
|
||||
// Color(0xffff48423d)),
|
||||
// elevation:
|
||||
// MaterialStateProperty.all(
|
||||
// 4.0),
|
||||
// ),
|
||||
// child: Stack(
|
||||
// children: [
|
||||
// Text(
|
||||
// 'Confirmed',
|
||||
// style: Constant.body1(
|
||||
// context: context)
|
||||
// .copyWith(
|
||||
// fontWeight:
|
||||
// FontWeight
|
||||
// .w600,
|
||||
// color: Constant
|
||||
// .white),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// onPressed: () {},
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// Tanggal Created align right
|
||||
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
'created : ' +
|
||||
formatDateString(
|
||||
listSearchHistory
|
||||
.value[idx]
|
||||
.tanggalcreated
|
||||
.toString(),
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Constant.body1(
|
||||
context: context)
|
||||
.copyWith(
|
||||
fontWeight: FontWeight.normal,
|
||||
fontStyle: FontStyle.italic,
|
||||
color: Constant.textBlack,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -39,6 +39,7 @@ class TransaksiSelectKategoriWidget extends StatelessWidget {
|
||||
value: option,
|
||||
child: Text(
|
||||
option.categoryname ?? "",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
color: Constant.textBlack, fontWeight: FontWeight.w400),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user