Cheque (service & screens) & Account
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:kmobile/data/models/user.dart';
|
||||
import 'package:kmobile/features/cheque/screens/cheque_enquiry_screen.dart';
|
||||
import 'package:kmobile/features/cheque/screens/positive_pay_screen.dart';
|
||||
import 'package:kmobile/features/cheque/screens/revoke_stop_screen.dart';
|
||||
import 'package:kmobile/features/cheque/screens/stop_cheque_screen.dart';
|
||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
@@ -43,8 +44,6 @@ class _ChequeManagementScreen extends State<ChequeManagementScreen> {
|
||||
child: ChequeManagementCardTile(
|
||||
icon: Symbols.payments,
|
||||
label: AppLocalizations.of(context).chequeEnquiryTitle,
|
||||
subtitle:
|
||||
AppLocalizations.of(context).chequeEnquirySubtitle,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
@@ -62,7 +61,6 @@ class _ChequeManagementScreen extends State<ChequeManagementScreen> {
|
||||
child: ChequeManagementCardTile(
|
||||
icon: Symbols.block_sharp,
|
||||
label: AppLocalizations.of(context).stopCheque,
|
||||
subtitle: AppLocalizations.of(context).stopChequeSubtitle,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
@@ -78,9 +76,8 @@ class _ChequeManagementScreen extends State<ChequeManagementScreen> {
|
||||
),
|
||||
Expanded(
|
||||
child: ChequeManagementCardTile(
|
||||
icon: Symbols.block_sharp,
|
||||
label: "Revoke Stop",
|
||||
subtitle: "Revoke your stopped cheques so as to reuse it",
|
||||
icon: Symbols.stop_circle,
|
||||
label: AppLocalizations.of(context).revokeStop,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
@@ -94,6 +91,23 @@ class _ChequeManagementScreen extends State<ChequeManagementScreen> {
|
||||
},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ChequeManagementCardTile(
|
||||
icon: Symbols.check_circle, // Using check_circle for Positive Pay
|
||||
label: AppLocalizations.of(context).positivePayTitle,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => PositivePayScreen(
|
||||
users: users,
|
||||
selectedIndex: selectedAccountIndex,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -120,7 +134,6 @@ class _ChequeManagementScreen extends State<ChequeManagementScreen> {
|
||||
class ChequeManagementCardTile extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final String? subtitle;
|
||||
final VoidCallback onTap;
|
||||
final bool disable;
|
||||
|
||||
@@ -128,7 +141,6 @@ class ChequeManagementCardTile extends StatelessWidget {
|
||||
super.key,
|
||||
required this.icon,
|
||||
required this.label,
|
||||
this.subtitle,
|
||||
required this.onTap,
|
||||
this.disable = false,
|
||||
});
|
||||
@@ -171,19 +183,6 @@ class ChequeManagementCardTile extends StatelessWidget {
|
||||
: theme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
if (subtitle != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Text(
|
||||
subtitle!,
|
||||
textAlign: TextAlign.center,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: disable
|
||||
? theme.disabledColor
|
||||
: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -192,4 +191,4 @@ class ChequeManagementCardTile extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
162
lib/features/cheque/screens/positive_pay_screen.dart
Normal file
162
lib/features/cheque/screens/positive_pay_screen.dart
Normal file
@@ -0,0 +1,162 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:kmobile/data/models/user.dart';
|
||||
import 'package:kmobile/l10n/app_localizations.dart';
|
||||
|
||||
class PositivePayScreen extends StatefulWidget {
|
||||
final List<User> users;
|
||||
final int selectedIndex;
|
||||
const PositivePayScreen({
|
||||
super.key,
|
||||
required this.users,
|
||||
required this.selectedIndex,
|
||||
});
|
||||
|
||||
@override
|
||||
State<PositivePayScreen> createState() => _PositivePayScreenState();
|
||||
}
|
||||
|
||||
class _PositivePayScreenState extends State<PositivePayScreen> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
final _accountNumberController = TextEditingController();
|
||||
final _chequeNumberController = TextEditingController();
|
||||
final _chequeDateController = TextEditingController();
|
||||
final _amountController = TextEditingController();
|
||||
final _payeeController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// Pre-fill the account number if possible
|
||||
if (widget.users.isNotEmpty) {
|
||||
_accountNumberController.text = widget.users[widget.selectedIndex].accountNo!;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_accountNumberController.dispose();
|
||||
_chequeNumberController.dispose();
|
||||
_chequeDateController.dispose();
|
||||
_amountController.dispose();
|
||||
_payeeController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
AppLocalizations.of(context).positivePay, // Will be replaced by localization
|
||||
),
|
||||
centerTitle: false,
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
const SizedBox(height: 16.0),
|
||||
TextFormField(
|
||||
controller: _accountNumberController,
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).accountNumber,
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Please enter account number';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16.0),
|
||||
TextFormField(
|
||||
controller: _chequeNumberController,
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).chequeNumberLabel,
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return AppLocalizations.of(context).pleaseEnterChequeNumber;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16.0),
|
||||
TextFormField(
|
||||
controller: _chequeDateController,
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).chequeIssuedDate,
|
||||
border: const OutlineInputBorder(),
|
||||
suffixIcon: const Icon(Icons.calendar_today),
|
||||
),
|
||||
readOnly: true,
|
||||
onTap: () async {
|
||||
DateTime? pickedDate = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime.now(),
|
||||
);
|
||||
if (pickedDate != null) {
|
||||
// Format the date as you wish
|
||||
String formattedDate = "${pickedDate.day}-${pickedDate.month}-${pickedDate.year}";
|
||||
_chequeDateController.text = formattedDate;
|
||||
}
|
||||
},
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return AppLocalizations.of(context).pleaseSelectChequeIssuedDate;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16.0),
|
||||
TextFormField(
|
||||
controller: _payeeController,
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).payeeName,
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16.0),
|
||||
TextFormField(
|
||||
controller: _amountController,
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).amountLabel,
|
||||
border: const OutlineInputBorder(),
|
||||
prefixText: '₹ ',
|
||||
),
|
||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return AppLocalizations.of(context).pleaseEnterAmount;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 32.0),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
// Process data
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(AppLocalizations.of(context).processingData)),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Text(AppLocalizations.of(context).proceedButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,7 @@ class _RevokeStopMultipleChequesScreenState extends State<RevokeStopMultipleCheq
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(AppLocalizations.of(context).stopMultipleChequesTitle),
|
||||
title: Text(AppLocalizations.of(context).revokeMultipleStops),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
@@ -188,7 +188,7 @@ class _RevokeStopMultipleChequesScreenState extends State<RevokeStopMultipleCheq
|
||||
readOnly: true,
|
||||
onTap: () => _selectDate(_stopIssueDateController),
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).stopIssueDateHint,
|
||||
labelText: AppLocalizations.of(context).revokeIssueDate,
|
||||
border: const OutlineInputBorder(),
|
||||
suffixIcon: IconButton(
|
||||
icon: const Icon(Icons.calendar_today),
|
||||
@@ -203,7 +203,7 @@ class _RevokeStopMultipleChequesScreenState extends State<RevokeStopMultipleCheq
|
||||
readOnly: true,
|
||||
onTap: () => _selectDate(_stopExpiryDateController),
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).stopExpiryDateHint,
|
||||
labelText: AppLocalizations.of(context).revokeExpiryDate,
|
||||
border: const OutlineInputBorder(),
|
||||
suffixIcon: IconButton(
|
||||
icon: const Icon(Icons.calendar_today),
|
||||
@@ -216,7 +216,8 @@ class _RevokeStopMultipleChequesScreenState extends State<RevokeStopMultipleCheq
|
||||
TextFormField(
|
||||
controller: _stopAmountController,
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).stopAmountHint,
|
||||
labelText: AppLocalizations.of(context).revokeAmount,
|
||||
prefixText: '₹ ',
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
@@ -237,7 +238,7 @@ class _RevokeStopMultipleChequesScreenState extends State<RevokeStopMultipleCheq
|
||||
});
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).stopCommentHint,
|
||||
labelText: AppLocalizations.of(context).revokeComment,
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
@@ -291,8 +292,8 @@ class _RevokeStopMultipleChequesScreenState extends State<RevokeStopMultipleCheq
|
||||
_showResponseDialog('Success', message);
|
||||
} if (status == 'ERROR') {
|
||||
String errMessage = "error";
|
||||
if(code == '0429') {
|
||||
errMessage = 'The selected Cheque is already stopped';
|
||||
if(code == '0172') {
|
||||
errMessage = 'The selected Cheque is not stopped';
|
||||
} else if(code == '0748') {
|
||||
errMessage = 'The selected Cheque is already presented';
|
||||
}
|
||||
@@ -326,7 +327,7 @@ class _RevokeStopMultipleChequesScreenState extends State<RevokeStopMultipleCheq
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Text(AppLocalizations.of(context).stopChequeButton),
|
||||
child: Text(AppLocalizations.of(context).revokeStopButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -122,7 +122,7 @@ class _RevokeStopChequeScreenState extends State<RevokeStopChequeScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("Revoke Stop Cheque"),
|
||||
title: Text(AppLocalizations.of(context).revokeStop),
|
||||
centerTitle: false,
|
||||
),
|
||||
body: Stack(
|
||||
@@ -206,7 +206,7 @@ class _RevokeStopChequeScreenState extends State<RevokeStopChequeScreen> {
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Center(
|
||||
child: Text(
|
||||
"Revoke Single Stop",
|
||||
AppLocalizations.of(context).revokeSingleStopTitle,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
@@ -256,7 +256,7 @@ class _RevokeStopChequeScreenState extends State<RevokeStopChequeScreen> {
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Center(
|
||||
child: Text(
|
||||
"Revoke Multiple Stops",
|
||||
AppLocalizations.of(context).revokeMultipleStops,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
|
||||
@@ -89,7 +89,7 @@ class _RevokeStopSingleChequeScreenState extends State<RevokeStopSingleChequeScr
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("Revoke Single Stop")),
|
||||
title: Text(AppLocalizations.of(context).revokeSingleStopTitle)),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Form(
|
||||
@@ -155,7 +155,7 @@ class _RevokeStopSingleChequeScreenState extends State<RevokeStopSingleChequeScr
|
||||
readOnly: true,
|
||||
onTap: () => _selectDate(_stopIssueDateController),
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).stopIssueDateLabel,
|
||||
labelText: AppLocalizations.of(context).revokeIssueDate,
|
||||
border: const OutlineInputBorder(),
|
||||
suffixIcon: IconButton(
|
||||
icon: const Icon(Icons.calendar_today),
|
||||
@@ -170,7 +170,7 @@ class _RevokeStopSingleChequeScreenState extends State<RevokeStopSingleChequeScr
|
||||
readOnly: true,
|
||||
onTap: () => _selectDate(_stopExpiryDateController),
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).stopExpiryDateLabel,
|
||||
labelText: AppLocalizations.of(context).revokeExpiryDate,
|
||||
border: const OutlineInputBorder(),
|
||||
suffixIcon: IconButton(
|
||||
icon: const Icon(Icons.calendar_today),
|
||||
@@ -183,7 +183,7 @@ class _RevokeStopSingleChequeScreenState extends State<RevokeStopSingleChequeScr
|
||||
TextFormField(
|
||||
controller: _stopAmountController,
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).stopAmountHint,
|
||||
labelText: AppLocalizations.of(context).revokeAmount,
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
@@ -204,7 +204,7 @@ class _RevokeStopSingleChequeScreenState extends State<RevokeStopSingleChequeScr
|
||||
});
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).stopCommentHint,
|
||||
labelText: AppLocalizations.of(context).revokeComment,
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
@@ -258,8 +258,8 @@ class _RevokeStopSingleChequeScreenState extends State<RevokeStopSingleChequeScr
|
||||
_showResponseDialog('Success', message);
|
||||
} if (status == 'ERROR') {
|
||||
String errMessage = "error";
|
||||
if(code == '0429') {
|
||||
errMessage = 'The selected Cheque is already stopped';
|
||||
if(code == '0172') {
|
||||
errMessage = 'The selected Cheque is not stopped';
|
||||
} else if(code == '0748') {
|
||||
errMessage = 'The selected Cheque is already presented';
|
||||
}
|
||||
@@ -293,7 +293,7 @@ class _RevokeStopSingleChequeScreenState extends State<RevokeStopSingleChequeScr
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Text("Revoke Stop"),
|
||||
child: Text(AppLocalizations.of(context).revokeStopButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user