Updated pages
This commit is contained in:
parent
cf9cdafc6b
commit
9268a3337d
4 changed files with 138 additions and 42 deletions
|
|
@ -1,11 +1,11 @@
|
||||||
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:intl/intl.dart';
|
||||||
import 'package:ocbo_esign_mobile/blocs/application/functions/bloc_getapplication.dart';
|
import 'package:ocbo_esign_mobile/blocs/application/functions/bloc_getapplication.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';
|
||||||
|
import 'package:ocbo_esign_mobile/widgets/loading_widget.dart';
|
||||||
import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
|
import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
|
||||||
|
|
||||||
class ApplicationInfoPage extends StatefulWidget {
|
class ApplicationInfoPage extends StatefulWidget {
|
||||||
|
|
@ -16,13 +16,25 @@ class ApplicationInfoPage extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ApplicationInfoPageState extends State<ApplicationInfoPage> {
|
class _ApplicationInfoPageState extends State<ApplicationInfoPage> {
|
||||||
|
// final NumberFormat formatter = NumberFormat('#,###.##');
|
||||||
|
final NumberFormat formatter = NumberFormat.currency(symbol: '₱ ', decimalDigits: 2);
|
||||||
|
|
||||||
late String _applicationNo = '';
|
late String _applicationNo = '';
|
||||||
late String _name = '';
|
late String _name = '';
|
||||||
late String _month = '';
|
late String _monthApproved = '';
|
||||||
late String _day = '';
|
late String _dayApproved = '';
|
||||||
late String _year = '';
|
late String _yearApproved = '';
|
||||||
|
late String _monthPrinted = '';
|
||||||
|
late String _dayPrinted = '';
|
||||||
|
late String _yearPrinted = '';
|
||||||
|
late String _amount = '';
|
||||||
|
late bool _isLoading = false;
|
||||||
|
|
||||||
void _getInfo() async {
|
void _getInfo() async {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = true;
|
||||||
|
});
|
||||||
|
|
||||||
late String applicationBloc = '';
|
late String applicationBloc = '';
|
||||||
late String qrBloc = '';
|
late String qrBloc = '';
|
||||||
|
|
||||||
|
|
@ -33,14 +45,22 @@ class _ApplicationInfoPageState extends State<ApplicationInfoPage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
final id = await getApi('get-esignid-byname', qrBloc, null);
|
final id = await getApi('get-esignid-byname', qrBloc, null);
|
||||||
final response = await getApi('get-infoapproval-electrical', applicationBloc, id["result"].toString());
|
final responseApproval = await getApi('get-infoapproval-electrical', applicationBloc, id["result"].toString());
|
||||||
|
final responsePrinted = await getApi('get-infoprinted-electrical', applicationBloc, id["result"].toString());
|
||||||
|
final responseAmount = await getApi('get-totalamount-electrical', applicationBloc, null);
|
||||||
|
final formattedAmount = formatter.format(double.parse(responseAmount["result"].toString()));
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_applicationNo = applicationBloc;
|
_applicationNo = applicationBloc;
|
||||||
_name = response["result"].toString();
|
_name = responseApproval["result"].toString();
|
||||||
_month = response["result2"].toString();
|
_monthApproved = responseApproval["result2"].toString();
|
||||||
_day = response["result3"].toString();
|
_dayApproved = responseApproval["result3"].toString();
|
||||||
_year = response["result4"].toString();
|
_yearApproved = responseApproval["result4"].toString();
|
||||||
|
_monthPrinted = responsePrinted["result"].toString();
|
||||||
|
_dayPrinted = responsePrinted["result2"].toString();
|
||||||
|
_yearPrinted = responsePrinted["result3"].toString();
|
||||||
|
_amount = formattedAmount;
|
||||||
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,12 +96,29 @@ class _ApplicationInfoPageState extends State<ApplicationInfoPage> {
|
||||||
const Gap(88),
|
const Gap(88),
|
||||||
BoxWidget(
|
BoxWidget(
|
||||||
circular: 16,
|
circular: 16,
|
||||||
content: Center(child: TextWidget(text: _applicationNo, bold: true)),
|
padding: EdgeInsets.all(8),
|
||||||
|
content: _isLoading
|
||||||
|
? Center(child: LoadingWidget(text: 'Gathering Data, please wait'))
|
||||||
|
: Center(child: TextWidget(text: _applicationNo, bold: true, size: 30)),
|
||||||
),
|
),
|
||||||
const Gap(16),
|
const Gap(16),
|
||||||
BoxWidget(
|
BoxWidget(
|
||||||
circular: 16,
|
circular: 16,
|
||||||
content: Center(child: TextWidget(text: _name, bold: false, size: 16)),
|
padding: EdgeInsets.all(8),
|
||||||
|
content: Center(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const TextWidget(
|
||||||
|
text: 'Name of Owner',
|
||||||
|
bold: false,
|
||||||
|
size: 8,
|
||||||
|
color: Color.fromRGBO(255, 255, 255, 0.8),
|
||||||
|
),
|
||||||
|
const Gap(4),
|
||||||
|
TextWidget(text: _name, bold: false, size: 16),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const Gap(8),
|
const Gap(8),
|
||||||
Row(
|
Row(
|
||||||
|
|
@ -89,7 +126,7 @@ class _ApplicationInfoPageState extends State<ApplicationInfoPage> {
|
||||||
children: [
|
children: [
|
||||||
BoxWidget(
|
BoxWidget(
|
||||||
circular: 16,
|
circular: 16,
|
||||||
width: 180,
|
width: 140,
|
||||||
padding: EdgeInsets.all(0),
|
padding: EdgeInsets.all(0),
|
||||||
content: Center(
|
content: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|
@ -101,16 +138,16 @@ class _ApplicationInfoPageState extends State<ApplicationInfoPage> {
|
||||||
color: Color.fromRGBO(255, 255, 255, 0.8),
|
color: Color.fromRGBO(255, 255, 255, 0.8),
|
||||||
),
|
),
|
||||||
const Gap(4),
|
const Gap(4),
|
||||||
TextWidget(text: _month, bold: false, size: 16),
|
TextWidget(text: _monthApproved, bold: false, size: 16),
|
||||||
TextWidget(text: _day, bold: true, size: 48),
|
TextWidget(text: _dayApproved, bold: true, size: 40),
|
||||||
TextWidget(text: _year, bold: false, size: 16),
|
TextWidget(text: _yearApproved, bold: false, size: 16),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
BoxWidget(
|
BoxWidget(
|
||||||
circular: 16,
|
circular: 16,
|
||||||
width: 180,
|
width: 140,
|
||||||
padding: EdgeInsets.all(0),
|
padding: EdgeInsets.all(0),
|
||||||
content: Center(
|
content: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|
@ -122,15 +159,34 @@ class _ApplicationInfoPageState extends State<ApplicationInfoPage> {
|
||||||
color: Color.fromRGBO(255, 255, 255, 0.8),
|
color: Color.fromRGBO(255, 255, 255, 0.8),
|
||||||
),
|
),
|
||||||
const Gap(4),
|
const Gap(4),
|
||||||
TextWidget(text: _month, bold: false, size: 16),
|
TextWidget(text: _monthPrinted, bold: false, size: 16),
|
||||||
TextWidget(text: _day, bold: true, size: 48),
|
TextWidget(text: _dayPrinted, bold: true, size: 40),
|
||||||
TextWidget(text: _year, bold: false, size: 16),
|
TextWidget(text: _yearPrinted, bold: false, size: 16),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
const Gap(8),
|
||||||
|
BoxWidget(
|
||||||
|
circular: 16,
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
content: Center(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const TextWidget(
|
||||||
|
text: 'Total Amount',
|
||||||
|
bold: false,
|
||||||
|
size: 8,
|
||||||
|
color: Color.fromRGBO(255, 255, 255, 0.8),
|
||||||
|
),
|
||||||
|
const Gap(4),
|
||||||
|
TextWidget(text: _amount, bold: true, size: 32),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -46,18 +46,13 @@ class IndexPage extends StatelessWidget {
|
||||||
const Gap(88),
|
const Gap(88),
|
||||||
const ImageWidget(imagePath: 'assets/esign-mobile.webp', size: 160, measureByHeight: false),
|
const ImageWidget(imagePath: 'assets/esign-mobile.webp', size: 160, measureByHeight: false),
|
||||||
const Gap(20),
|
const Gap(20),
|
||||||
const TextWidget(
|
const TextWidget(text: "OCBO e-Sign", color: Color.fromRGBO(244, 243, 243, 1), bold: true, size: 34),
|
||||||
text: "OCBO e-Sign",
|
|
||||||
color: Color.fromARGB(255, 244, 243, 243),
|
|
||||||
bold: true,
|
|
||||||
size: 34,
|
|
||||||
),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(right: (screenWidth / 2) - 100),
|
padding: EdgeInsets.only(right: (screenWidth / 2) - 100),
|
||||||
child: const Row(
|
child: const Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
TextWidget(text: "Mobile", color: Color.fromARGB(255, 244, 243, 243), bold: false, size: 16),
|
TextWidget(text: "Mobile", color: Color.fromRGBO(244, 243, 243, 1), bold: false, size: 16),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -85,15 +80,36 @@ class IndexPage extends StatelessWidget {
|
||||||
const MaxGap(516),
|
const MaxGap(516),
|
||||||
const Opacity(
|
const Opacity(
|
||||||
opacity: 0.7,
|
opacity: 0.7,
|
||||||
child: ImageWidget(imagePath: 'assets/pat-alcala.webp', size: 74, measureByHeight: false),
|
child: Column(
|
||||||
),
|
children: [
|
||||||
const Gap(4),
|
ImageWidget(imagePath: 'assets/ocbologo.webp', size: 26, measureByHeight: false),
|
||||||
const TextWidget(
|
Gap(8),
|
||||||
text: "Developed By: Pat Alcala",
|
TextWidget(text: '© 2026 Office of the City Building Official', size: 10),
|
||||||
|
Gap(8),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
TextWidget(
|
||||||
|
text: "Developed By:",
|
||||||
color: Color.fromRGBO(244, 243, 243, 0.7),
|
color: Color.fromRGBO(244, 243, 243, 0.7),
|
||||||
bold: false,
|
bold: false,
|
||||||
size: 10,
|
size: 10,
|
||||||
),
|
),
|
||||||
|
Gap(4),
|
||||||
|
ImageWidget(imagePath: 'assets/pat-alcala.webp', size: 60, measureByHeight: false),
|
||||||
|
Gap(4),
|
||||||
|
TextWidget(
|
||||||
|
text: "Pat Alcala",
|
||||||
|
color: Color.fromRGBO(244, 243, 243, 0.7),
|
||||||
|
bold: false,
|
||||||
|
size: 10,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
const Gap(24),
|
const Gap(24),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ 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';
|
||||||
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';
|
||||||
|
import 'package:ocbo_esign_mobile/widgets/loading_widget.dart';
|
||||||
import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
|
import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
|
@ -19,7 +20,7 @@ class ValidateDetailPage extends StatefulWidget {
|
||||||
|
|
||||||
class _ValidateDetailPageState extends State<ValidateDetailPage> {
|
class _ValidateDetailPageState extends State<ValidateDetailPage> {
|
||||||
final _searchController = TextEditingController();
|
final _searchController = TextEditingController();
|
||||||
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 bool isLoading = false;
|
||||||
|
|
@ -129,7 +130,7 @@ class _ValidateDetailPageState extends State<ValidateDetailPage> {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
isLoading
|
isLoading
|
||||||
? TextWidget(text: 'Loading Data, please wait', size: 20, bold: false)
|
? LoadingWidget(text: 'Loading Data, please wait')
|
||||||
: Column(
|
: Column(
|
||||||
children: [
|
children: [
|
||||||
TextWidget(text: formatter.format(_total), size: 50, bold: true),
|
TextWidget(text: formatter.format(_total), size: 50, bold: true),
|
||||||
|
|
@ -169,7 +170,7 @@ class _ValidateDetailPageState extends State<ValidateDetailPage> {
|
||||||
const Gap(4),
|
const Gap(4),
|
||||||
TextWidget(text: 'Time: ${_timeList[index]}', size: 10, opacity: 1),
|
TextWidget(text: 'Time: ${_timeList[index]}', size: 10, opacity: 1),
|
||||||
const Gap(4),
|
const Gap(4),
|
||||||
TextWidget(text: 'Tap to show details', size: 9, opacity: 0.6),
|
const TextWidget(text: 'Tap to show details', size: 9, opacity: 0.6),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import 'package:mobile_scanner/mobile_scanner.dart';
|
||||||
import 'package:ocbo_esign_mobile/blocs/qr/functions/bloc_setqr.dart';
|
import 'package:ocbo_esign_mobile/blocs/qr/functions/bloc_setqr.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/button_widget.dart';
|
import 'package:ocbo_esign_mobile/widgets/button_widget.dart';
|
||||||
|
import 'package:ocbo_esign_mobile/widgets/loading_widget.dart';
|
||||||
import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
|
import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
|
||||||
import 'package:vibration/vibration.dart';
|
import 'package:vibration/vibration.dart';
|
||||||
|
|
||||||
|
|
@ -26,13 +27,18 @@ class BarcodeScannerScreen extends StatefulWidget {
|
||||||
|
|
||||||
class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
||||||
final Color _redColorShade = const Color.fromRGBO(86, 38, 38, 0.2);
|
final Color _redColorShade = const Color.fromRGBO(86, 38, 38, 0.2);
|
||||||
final Color _redColor = const Color.fromRGBO(235, 88, 115, 0.91);
|
final Color _redColor = const Color.fromRGBO(235, 88, 115, 0.8);
|
||||||
final Color _greenColorShade = const Color.fromARGB(51, 41, 115, 43);
|
final Color _greenColorShade = const Color.fromRGBO(41, 115, 43, 0.2);
|
||||||
final Color _greenColor = const Color.fromRGBO(76, 206, 81, 0.91);
|
final Color _greenColor = const Color.fromRGBO(76, 206, 81, 0.8);
|
||||||
|
|
||||||
late String _qrResult = '';
|
late String _qrResult = '';
|
||||||
|
late bool _scanning = false;
|
||||||
|
|
||||||
void readQr(String value) async {
|
void readQr(String value) async {
|
||||||
|
setState(() {
|
||||||
|
_scanning = true;
|
||||||
|
});
|
||||||
|
|
||||||
if (value.contains('OCBO e-Sign')) {
|
if (value.contains('OCBO e-Sign')) {
|
||||||
final qr = value.substring(35);
|
final qr = value.substring(35);
|
||||||
final response = await getApi('check-qr', qr, null);
|
final response = await getApi('check-qr', qr, null);
|
||||||
|
|
@ -40,15 +46,18 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
||||||
|
|
||||||
if (result != '') {
|
if (result != '') {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
_scanning = false;
|
||||||
_qrResult = result;
|
_qrResult = result;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
_scanning = false;
|
||||||
_qrResult = 'non-exist';
|
_qrResult = 'non-exist';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
_scanning = false;
|
||||||
_qrResult = 'invalid';
|
_qrResult = 'invalid';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -61,6 +70,10 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void tryQR() async {
|
void tryQR() async {
|
||||||
|
setState(() {
|
||||||
|
_scanning = true;
|
||||||
|
});
|
||||||
|
|
||||||
final value = "Use OCBO e-Sign Validator - scanid=0918d59e";
|
final value = "Use OCBO e-Sign Validator - scanid=0918d59e";
|
||||||
|
|
||||||
if (value.contains('OCBO e-Sign')) {
|
if (value.contains('OCBO e-Sign')) {
|
||||||
|
|
@ -70,10 +83,12 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
_scanning = false;
|
||||||
_qrResult = result;
|
_qrResult = result;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
_scanning = false;
|
||||||
_qrResult = 'non-exist';
|
_qrResult = 'non-exist';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -85,6 +100,7 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
_scanning = false;
|
||||||
_qrResult = 'invalid';
|
_qrResult = 'invalid';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -180,7 +196,14 @@ 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 (_scanning)
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
const Gap(16),
|
||||||
|
const LoadingWidget(text: 'Reading QR'),
|
||||||
|
],
|
||||||
|
),
|
||||||
if (_qrResult.isNotEmpty)
|
if (_qrResult.isNotEmpty)
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue