bug fixed

This commit is contained in:
nutchayut
2025-01-07 15:02:31 +07:00
parent f16e5f491a
commit 4f344e5e00
2634 changed files with 46314 additions and 9884 deletions

View File

@@ -0,0 +1,182 @@
import 'dart:convert';
import 'package:cathaypay_mobile/Home/HomePage.dart';
import 'package:cathaypay_mobile/TopUp/topup_amout.dart';
import 'package:cathaypay_mobile/TopUp/topup_my_qr.dart';
import 'package:cathaypay_mobile/utils/utils.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import '../Home/home_bottom_menu_widget.dart';
import '../api/api.dart';
import '../model/transaction_model.dart';
class GetPaidHistory extends StatefulWidget {
const GetPaidHistory({Key? key}) : super(key: key);
@override
State<GetPaidHistory> createState() => _GetPaidHistoryState();
}
class _GetPaidHistoryState extends State<GetPaidHistory> {
List<TransactionsV4> listTrans = [];
getTransaction() {
listTrans.clear();
var date = DateTime.now();
var start = DateFormat('yyyy-MM-dd').format(DateTime.now());
var end = DateFormat('yyyy-MM-dd').format(DateTime(date.year - 1, date.month, date.day));
var param = jsonEncode(<dynamic, dynamic>{
"id": "",
"requestUserID": "",
"invoiceId": "",
"referencE1": "",
"referencE2": "",
// "paymentStatus": "WALLETADDED",
"paymentStatus": "CONFIRM",
"paymentChannel": "TRANSFERTO",
"createDatefrom": end,
"createDateto": start,
"requestName": "",
"payeeName": profile?.fullName,
"payerName": "",
"fullName": ""
});
Api.postAdmin(context, Api.getTransactionTopUpV4, param).then((value) => {
if (value != null)
{
print("postAdmin $value"),
value.forEach((v) {
listTrans.add(TransactionsV4.fromJson(v));
print("postAdmin ");
}),
refresh()
}
else
{
print("postAdmin nullllll"),
}
});
}
refresh() {
setState(() {});
}
@override
void initState() {
getTransaction();
super.initState();
}
@override
Widget build(BuildContext context) {
return Expanded(
child: ListView.builder(
itemCount: listTrans.length,
shrinkWrap: true,
itemBuilder: (BuildContext context, int index) {
TransactionsV4 transactions = listTrans[index];
return Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
Utils.convertDateToDay(transactions.updateDate ?? "", context),
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 16,
),
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.grey.shade100,
),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
transactions.paymentChannel ?? "",
style: GoogleFonts.kanit(
color: Color(0xff65676b),
fontSize: 16,
fontWeight: FontWeight.w300,
),
),
Spacer(),
Text(
"${transactions.amount ?? ""} ${"Baht".tr()}",
textAlign: TextAlign.right,
style: GoogleFonts.kanit(
color: Color(0xff65676b),
fontSize: 16,
),
)
],
),
SizedBox(
height: 10,
),
Text(
"From ${transactions.payerName}" ?? "",
style: TextStyle(
color: Color(0xff65676b),
fontSize: 16,
),
),
Text(
Utils.convertDateToTime(transactions.phoneNumber ?? ""),
style: TextStyle(
color: Color(0xff65676b),
fontSize: 14,
fontWeight: FontWeight.w300,
),
),
Text(
Utils.convertDateToTime(transactions.updateDate ?? ""),
style: TextStyle(
color: Color(0xff65676b),
fontSize: 14,
fontWeight: FontWeight.w300,
),
),
/* Text(
Utils.convertDateToTime("Trans.ID. ${transactions.ePaymentTransactionID}" ?? ""),
style: TextStyle(
color: Color(0xff65676b),
fontSize: 14,
fontWeight: FontWeight.w300,
),
),*/
// Row(
// children: [
// Spacer(),
// Icon(
// Icons.keyboard_arrow_down,
// color: Colors.grey.shade400,
// size: 30,
// )
// ],
// ),
],
),
),
),
],
),
);
}));
}
}