Updated pages

This commit is contained in:
Patrick Alvin Alcala 2026-02-06 18:48:13 +08:00
parent 58a104b772
commit ea51af0eb9
4 changed files with 168 additions and 212 deletions

View file

@ -61,7 +61,7 @@ class IndexPage extends StatelessWidget {
], ],
), ),
), ),
const Gap(184), const Gap(168),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
spacing: 32, spacing: 32,

View file

@ -1,12 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart'; // import 'package:go_router/go_router.dart';
import 'package:hashlib/hashlib.dart'; // import 'package:hashlib/hashlib.dart';
import 'package:ocbo_esign_mobile/blocs/user/functions/bloc_setuser.dart'; // import 'package:ocbo_esign_mobile/blocs/user/functions/bloc_setuser.dart';
import 'package:ocbo_esign_mobile/functions/get_api.dart'; // import 'package:ocbo_esign_mobile/functions/get_api.dart';
import 'package:ocbo_esign_mobile/functions/modal.dart'; // import 'package:ocbo_esign_mobile/functions/modal.dart';
import 'package:ocbo_esign_mobile/widgets/box_widget.dart';
import 'package:ocbo_esign_mobile/widgets/button_widget.dart'; import 'package:ocbo_esign_mobile/widgets/button_widget.dart';
import 'package:ocbo_esign_mobile/widgets/image_widget.dart'; import 'package:ocbo_esign_mobile/widgets/image_widget.dart';
import 'package:ocbo_esign_mobile/widgets/input_widget.dart'; import 'package:ocbo_esign_mobile/widgets/input_widget.dart';
@ -23,7 +22,7 @@ class LoginPage extends StatefulWidget {
class _LoginPageState extends State<LoginPage> { class _LoginPageState extends State<LoginPage> {
final _passwordController = TextEditingController(); final _passwordController = TextEditingController();
final _approver = dotenv.env['HEAD']!; final _approver = dotenv.env['HEAD']!;
final _approverId = dotenv.env['HEADID']!; // final _approverId = dotenv.env['HEADID']!;
late ValueNotifier<String> passwordNotifier; late ValueNotifier<String> passwordNotifier;
@override @override
@ -53,13 +52,13 @@ class _LoginPageState extends State<LoginPage> {
// } // }
// } // }
Future<String> _securePassword(String password) async { // Future<String> _securePassword(String password) async {
final firstHash = sha1.string(password); // final firstHash = sha1.string(password);
final secondHash = sha384.string(firstHash.toString()); // final secondHash = sha384.string(firstHash.toString());
final thirdHash = sha1.string(secondHash.toString()); // final thirdHash = sha1.string(secondHash.toString());
return thirdHash.toString(); // return thirdHash.toString();
} // }
// void _login() async { // void _login() async {
// final connected = await _checkConnection(); // final connected = await _checkConnection();
@ -79,14 +78,14 @@ class _LoginPageState extends State<LoginPage> {
// } // }
// } // }
void _setLogin() { // void _setLogin() {
blocSetUser(context, _approver); // blocSetUser(context, _approver);
context.push('/approval'); // context.push('/approval');
} // }
void _showDialog() { // void _showDialog() {
showModal(context, 'Error', 'Invalid password, try again.', true); // showModal(context, 'Error', 'Invalid password, try again.', true);
} // }
void _ignoreButton() {} void _ignoreButton() {}

View file

@ -1,7 +1,7 @@
import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart';
import 'package:ocbo_esign_mobile/blocs/application/functions/bloc_setapplication.dart';
import 'package:ocbo_esign_mobile/blocs/qr/functions/bloc_getqr.dart'; import 'package:ocbo_esign_mobile/blocs/qr/functions/bloc_getqr.dart';
import 'package:ocbo_esign_mobile/functions/get_api.dart'; import 'package:ocbo_esign_mobile/functions/get_api.dart';
import 'package:ocbo_esign_mobile/widgets/box_widget.dart'; import 'package:ocbo_esign_mobile/widgets/box_widget.dart';
@ -22,11 +22,19 @@ class _ValidateDetailPageState extends State<ValidateDetailPage> {
final NumberFormat formatter = NumberFormat('#,###.##'); final NumberFormat formatter = NumberFormat('#,###.##');
final dateFormatter = DateFormat('yyyy-MM-dd'); final dateFormatter = DateFormat('yyyy-MM-dd');
// final Color greenColor = const Color(0xFF4CCE51); // final Color greenColor = const Color(0xFF4CCE51);
late bool isLoading = false;
late int _total = 0; late int _total = 0;
late List _applicationList = []; late List _applicationList = [];
late List _dateList = []; late List _dateList = [];
late List _timeList = [];
late String _name = '';
late int _count = 0;
void _getTotalSigned() async { void _getTotalSigned() async {
setState(() {
isLoading = true;
});
final name = await blocGetQr(context); final name = await blocGetQr(context);
final responseCount = await getApi('get-transactions-count', name, null); final responseCount = await getApi('get-transactions-count', name, null);
final total = responseCount['result']; final total = responseCount['result'];
@ -34,21 +42,62 @@ class _ValidateDetailPageState extends State<ValidateDetailPage> {
final response = await getApi('get-transactions', name, null); final response = await getApi('get-transactions', name, null);
final applicationNoList = response['result']; final applicationNoList = response['result'];
final dateList = response['result2']; final dateList = response['result2'];
final timeList = response['result3'];
_name = name;
setState(() { setState(() {
isLoading = false;
_total = double.parse(total).toInt(); _total = double.parse(total).toInt();
_count = applicationNoList.length;
_applicationList = applicationNoList; _applicationList = applicationNoList;
_dateList = dateList; _dateList = dateList;
_timeList = timeList;
}); });
} }
void _filterSigned(String application) async {
final response = await getApi('get-transactions-filter', _name, application);
final applicationNoList = response['result'];
final dateList = response['result2'];
final timeList = response['result3'];
setState(() {
// isLoading = false;
// _total = double.parse(total).toInt();
_count = applicationNoList.length;
_applicationList = applicationNoList;
_dateList = dateList;
_timeList = timeList;
});
}
void _onTextChanged() {
_filterSigned(_searchController.text);
}
void _gotoInfo() {
context.push('/info');
}
void _showDetails(String application) async {
await blocSetApplication(context, application);
_gotoInfo();
}
@override @override
void initState() { void initState() {
_getTotalSigned(); _getTotalSigned();
_searchController.addListener(_onTextChanged);
super.initState(); super.initState();
} }
@override
void dispose() {
_searchController.removeListener(_onTextChanged);
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -73,13 +122,15 @@ class _ValidateDetailPageState extends State<ValidateDetailPage> {
width: MediaQuery.of(context).size.width - 112, width: MediaQuery.of(context).size.width - 112,
child: Column( child: Column(
children: [ children: [
const Gap(88), const Gap(72),
BoxWidget( BoxWidget(
circular: 16, circular: 16,
content: Row( content: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Column( isLoading
? TextWidget(text: 'Loading Data, please wait', size: 20, bold: false)
: Column(
children: [ children: [
TextWidget(text: formatter.format(_total), size: 50, bold: true), TextWidget(text: formatter.format(_total), size: 50, bold: true),
const TextWidget(text: 'Total Signed Applications', size: 16), const TextWidget(text: 'Total Signed Applications', size: 16),
@ -89,49 +140,17 @@ class _ValidateDetailPageState extends State<ValidateDetailPage> {
), ),
), ),
const Gap(16), const Gap(16),
ClipRRect( InputWidget(controller: _searchController, password: false, placeholder: 'Filter Application Number'),
// borderRadius: BorderRadius.circular(36), const Gap(16),
child: InputWidget(
controller: _searchController,
password: false,
placeholder: 'Search Application Number',
),
),
const Gap(24),
// ListView(
// scrollDirection: Axis.horizontal,
// padding: EdgeInsets.symmetric(horizontal: 16),
// children: [
// // BoxWidget(
// // alignment: CrossAxisAlignment.center,
// // circular: 16,
// // content: Row(
// // children: [
// // const ImageWidget(imagePath: 'assets/esign.webp', size: 48, measureByHeight: true),
// // const Gap(16),
// // Column(
// // crossAxisAlignment: CrossAxisAlignment.start,
// // children: [
// // TextWidget(text: '23-000123', size: 18, bold: true),
// // const Gap(4),
// // TextWidget(text: 'Total Signed Applications', size: 12),
// // ],
// // ),
// // ],
// // ),
// // ),
// ],
// ),
Expanded( Expanded(
flex: 1,
child: ListView.builder( child: ListView.builder(
itemCount: _total, padding: EdgeInsets.only(bottom: 16),
itemCount: _count,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Column( return InkWell(
crossAxisAlignment: CrossAxisAlignment.stretch, onTap: () => _showDetails(_applicationList[index]),
mainAxisAlignment: MainAxisAlignment.start, child: BoxWidget(
children: [
BoxWidget(
alignment: CrossAxisAlignment.center, alignment: CrossAxisAlignment.center,
circular: 16, circular: 16,
content: Row( content: Row(
@ -144,91 +163,22 @@ class _ValidateDetailPageState extends State<ValidateDetailPage> {
TextWidget(text: _applicationList[index], size: 18, bold: true), TextWidget(text: _applicationList[index], size: 18, bold: true),
const Gap(4), const Gap(4),
SizedBox( SizedBox(
width: 190, width: 180,
child: TextWidget(text: '8990 Housing Development Corporation', size: 10), child: TextWidget(text: 'Date Signed: ${_dateList[index]}', size: 10, opacity: 1),
), ),
const Gap(4), const Gap(4),
TextWidget(text: _dateList[index], size: 10, opacity: 0.8), TextWidget(text: 'Time: ${_timeList[index]}', size: 10, opacity: 1),
const Gap(4),
TextWidget(text: 'Tap to show details', size: 9, opacity: 0.6),
], ],
), ),
], ],
), ),
), ),
const Gap(8),
],
); );
}, },
), ),
), ),
// Column(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// BoxWidget(
// alignment: CrossAxisAlignment.center,
// circular: 16,
// content: Row(
// children: [
// const ImageWidget(imagePath: 'assets/esign.webp', size: 48, measureByHeight: true),
// const Gap(16),
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// TextWidget(text: '23-000123', size: 18, bold: true),
// const Gap(4),
// TextWidget(text: 'Total Signed Applications', size: 12),
// ],
// ),
// ],
// ),
// ),
// // const Gap(8),
// // BoxWidget(
// // alignment: CrossAxisAlignment.center,
// // circular: 16,
// // content: Row(
// // children: [
// // const ImageWidget(imagePath: 'assets/esign.webp', size: 48, measureByHeight: true),
// // const Gap(16),
// // Column(
// // crossAxisAlignment: CrossAxisAlignment.start,
// // children: [
// // TextWidget(text: '23-000123', size: 18, bold: true),
// // const Gap(4),
// // TextWidget(text: 'Total Signed Applications', size: 12),
// // const Gap(4),
// // Expanded(
// // child: Row(
// // mainAxisAlignment: MainAxisAlignment.end,
// // children: [TextWidget(text: 'Dates', size: 8)],
// // ),
// // ),
// // ],
// // ),
// // ],
// // ),
// // ),
// // const Gap(8),
// // BoxWidget(
// // alignment: CrossAxisAlignment.center,
// // circular: 16,
// // content: Row(
// // children: [
// // const ImageWidget(imagePath: 'assets/esign.webp', size: 48, measureByHeight: true),
// // const Gap(16),
// // Column(
// // crossAxisAlignment: CrossAxisAlignment.start,
// // children: [
// // TextWidget(text: '23-000123', size: 18, bold: true),
// // const Gap(4),
// // TextWidget(text: 'Total Signed Applications', size: 12),
// // ],
// // ),
// // ],
// // ),
// // ),
// ],
// ),
], ],
), ),
), ),

View file

@ -1,5 +1,3 @@
import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
@ -27,12 +25,12 @@ class BarcodeScannerScreen extends StatefulWidget {
} }
class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> { class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
late String qrResult = ''; final Color _redColorShade = const Color.fromRGBO(86, 38, 38, 0.2);
late String qrResultSub = ''; final Color _redColor = const Color.fromRGBO(235, 88, 115, 0.91);
final Color redColorShade = const Color.fromARGB(26, 225, 82, 103); final Color _greenColorShade = const Color.fromARGB(51, 41, 115, 43);
final Color redColor = const Color.fromARGB(255, 229, 89, 115); final Color _greenColor = const Color.fromRGBO(76, 206, 81, 0.91);
final Color greenColorShade = const Color.fromRGBO(69, 191, 73, 0.1);
final Color greenColor = const Color.fromRGBO(76, 206, 81, 1); late String _qrResult = '';
void readQr(String value) async { void readQr(String value) async {
if (value.contains('OCBO e-Sign')) { if (value.contains('OCBO e-Sign')) {
@ -42,21 +40,21 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
if (result != '') { if (result != '') {
setState(() { setState(() {
qrResult = result; _qrResult = result;
}); });
} else { } else {
setState(() { setState(() {
qrResult = 'non-exist'; _qrResult = 'non-exist';
}); });
} }
} else { } else {
setState(() { setState(() {
qrResult = 'invalid'; _qrResult = 'invalid';
}); });
Future.delayed(Duration(seconds: 3), () { Future.delayed(Duration(seconds: 3), () {
setState(() { setState(() {
qrResult = ''; _qrResult = '';
}); });
}); });
} }
@ -72,38 +70,42 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
if (result != null) { if (result != null) {
setState(() { setState(() {
qrResult = result; _qrResult = result;
}); });
} else { } else {
setState(() { setState(() {
qrResult = 'non-exist'; _qrResult = 'non-exist';
}); });
Future.delayed(Duration(seconds: 3), () { Future.delayed(Duration(seconds: 3), () {
setState(() { setState(() {
qrResult = ''; _qrResult = '';
}); });
}); });
} }
} else { } else {
setState(() { setState(() {
qrResult = 'invalid'; _qrResult = 'invalid';
}); });
Future.delayed(Duration(seconds: 3), () { Future.delayed(Duration(seconds: 3), () {
setState(() { setState(() {
qrResult = ''; _qrResult = '';
}); });
}); });
} }
} }
void updateBlockQr() async { void updateBlockQr() async {
await blocSetQr(context, qrResult); await blocSetQr(context, _qrResult);
} }
void gotoDetails() { void gotoDetails() {
updateBlockQr(); updateBlockQr();
setState(() {
_qrResult = '';
});
context.push('/details'); context.push('/details');
} }
@ -140,7 +142,7 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
), ),
child: const TextWidget(text: 'Scan OCBO e-Sign QR Code', size: 14, bold: true), child: const TextWidget(text: 'Scan OCBO e-Sign QR Code', size: 14, bold: true),
), ),
const Gap(24), const Gap(16),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(36), borderRadius: BorderRadius.circular(36),
@ -158,8 +160,8 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
// ), // ),
// ], // ],
), ),
height: 330, height: 308,
width: 340, width: 318,
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(36), // Adjust the radius as needed borderRadius: BorderRadius.circular(36), // Adjust the radius as needed
child: MobileScanner( child: MobileScanner(
@ -178,11 +180,11 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
), ),
), ),
const Gap(24), const Gap(24),
ButtonWidget(text: 'Try API', disabled: false, onPressed: tryQR), // ButtonWidget(text: 'Try API', disabled: false, onPressed: tryQR),
if (qrResult.isNotEmpty) if (_qrResult.isNotEmpty)
Column( Column(
children: [ children: [
if (qrResult == 'invalid') if (_qrResult == 'invalid')
Column( Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
@ -190,32 +192,32 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
width: 220, width: 220,
padding: const EdgeInsets.fromLTRB(0, 16, 0, 32), padding: const EdgeInsets.fromLTRB(0, 16, 0, 32),
decoration: BoxDecoration( decoration: BoxDecoration(
border: BoxBorder.all(color: redColor), border: BoxBorder.all(color: _redColor),
color: redColorShade, color: _redColorShade,
borderRadius: BorderRadius.circular(32), borderRadius: BorderRadius.circular(32),
), ),
child: Column( child: Column(
children: [ children: [
TextWidget(text: 'Invalid', bold: true, size: 24, color: redColor), TextWidget(text: 'Invalid', bold: true, size: 24, color: _redColor),
const Gap(16), const Gap(16),
Container( Container(
width: 90, width: 90,
height: 90, height: 90,
decoration: BoxDecoration( decoration: BoxDecoration(
color: redColorShade, color: _redColorShade,
border: Border.all(color: redColor, width: 2), border: Border.all(color: _redColor, width: 2),
borderRadius: BorderRadius.circular(99), borderRadius: BorderRadius.circular(99),
), ),
child: Icon(Icons.close, color: redColor, size: 48), child: Icon(Icons.close, color: _redColor, size: 48),
), ),
], ],
), ),
), ),
const Gap(16), const Gap(16),
TextWidget(text: 'Not valid OCBO e-Sign QR', bold: true, size: 20, color: redColor), TextWidget(text: 'QR Detected is not OCBO e-Sign', bold: true, size: 20, color: _redColor),
], ],
) )
else if (qrResult == 'non-exist') else if (_qrResult == 'non-exist')
Column( Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
@ -223,29 +225,34 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
width: 220, width: 220,
padding: const EdgeInsets.fromLTRB(0, 16, 0, 32), padding: const EdgeInsets.fromLTRB(0, 16, 0, 32),
decoration: BoxDecoration( decoration: BoxDecoration(
border: BoxBorder.all(color: redColor), border: BoxBorder.all(color: _redColor),
color: redColorShade, color: _redColorShade,
borderRadius: BorderRadius.circular(32), borderRadius: BorderRadius.circular(32),
), ),
child: Column( child: Column(
children: [ children: [
TextWidget(text: 'Unregistered', bold: true, size: 24, color: redColor), TextWidget(text: 'Unregistered', bold: true, size: 24, color: _redColor),
const Gap(16), const Gap(16),
Container( Container(
width: 90, width: 90,
height: 90, height: 90,
decoration: BoxDecoration( decoration: BoxDecoration(
color: redColorShade, color: _redColorShade,
border: Border.all(color: redColor, width: 2), border: Border.all(color: _redColor, width: 2),
borderRadius: BorderRadius.circular(99), borderRadius: BorderRadius.circular(99),
), ),
child: Icon(Icons.close, color: redColor, size: 48), child: Icon(Icons.close, color: _redColor, size: 48),
), ),
], ],
), ),
), ),
const Gap(16), const Gap(16),
TextWidget(text: 'OCBO e-Sign QR is not registered', bold: true, size: 20, color: redColor), TextWidget(
text: 'OCBO e-Sign QR is not registered',
bold: true,
size: 20,
color: _redColor,
),
], ],
) )
else else
@ -256,32 +263,32 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
width: 220, width: 220,
padding: const EdgeInsets.fromLTRB(0, 16, 0, 32), padding: const EdgeInsets.fromLTRB(0, 16, 0, 32),
decoration: BoxDecoration( decoration: BoxDecoration(
border: BoxBorder.all(color: greenColor), border: BoxBorder.all(color: _greenColor),
color: greenColorShade, color: _greenColorShade,
borderRadius: BorderRadius.circular(32), borderRadius: BorderRadius.circular(32),
), ),
child: Column( child: Column(
children: [ children: [
TextWidget(text: 'Valid', bold: true, size: 24, color: greenColor), TextWidget(text: 'Valid', bold: true, size: 24, color: _greenColor),
const Gap(16), const Gap(16),
Container( Container(
padding: EdgeInsets.all(0), padding: EdgeInsets.all(0),
width: 90, width: 90,
height: 90, height: 90,
decoration: BoxDecoration( decoration: BoxDecoration(
color: greenColorShade, color: _greenColorShade,
border: Border.all(color: greenColor, width: 2), border: Border.all(color: _greenColor, width: 2),
borderRadius: BorderRadius.circular(99), borderRadius: BorderRadius.circular(99),
), ),
child: Icon(Icons.check, color: greenColor, size: 48), child: Icon(Icons.check, color: _greenColor, size: 48),
), ),
], ],
), ),
), ),
const Gap(24), const Gap(16),
TextWidget(text: qrResult, bold: true, size: 20, color: greenColor), TextWidget(text: _qrResult, bold: true, size: 18, color: _greenColor),
const Gap(24), const Gap(16),
ButtonWidget(text: "Check Signed Applications", disabled: false, onPressed: gotoDetails), ButtonWidget(text: "Validate Applications", disabled: false, onPressed: gotoDetails),
], ],
), ),
], ],