You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
diplomatic-quarter/lib/pages/pharmacies/screens/lacum-transfer-page.dart

316 lines
16 KiB
Dart

import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-trasnfer-viewModel.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
class LacumTransferPage extends StatefulWidget {
final LacumAccountInformation lacumInformation;
final LacumAccountInformation lacumGroupInformation;
LacumTransferPage(this.lacumInformation, this.lacumGroupInformation);
@override
_LacumTransferPageState createState() => _LacumTransferPageState();
}
class _LacumTransferPageState extends State<LacumTransferPage> {
TextEditingController _beneficieryAccountController =
new TextEditingController();
TextEditingController _transferPointsController = new TextEditingController();
@override
void initState() {
super.initState();
_beneficieryAccountController.text = "";
_transferPointsController.text = "0";
}
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
return BaseView<LacumTranferViewModel>(
onModelReady: (model) => model.setLakumData(
widget.lacumInformation, widget.lacumGroupInformation),
builder: (_, model, wi) => AppScaffold(
appBarTitle: "${TranslationBase.of(context).lakum}",
isShowAppBar: true,
isShowDecPage: false,
backgroundColor: Colors.white,
baseViewModel: model,
body: Container(
width: double.infinity,
child: SingleChildScrollView(
child: SizedBox(
height:
mediaQuery.size.height - 58 - mediaQuery.padding.top,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
Row(
children: [
Container(
height: 100,
width: mediaQuery.size.width / 2 - 26,
padding: EdgeInsets.only(
top: 12, left: 8, right: 8, bottom: 4),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8),
border: Border.fromBorderSide(BorderSide(
color: Color(0xffe1e1e1),
width: 0.4,
)),
color: Color(0xff6294ed),
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
children: [
Container(
child: Texts(
"Point Balance",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
],
),
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(
vertical: 8),
child: Column(
mainAxisAlignment:
MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Texts(
"0",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.white,
),
],
),
),
)
],
),
),
SizedBox(
width: 20,
),
Container(
height: 100,
width: mediaQuery.size.width / 2 - 26,
padding: EdgeInsets.only(
top: 12, left: 8, right: 8, bottom: 4),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8),
border: Border.fromBorderSide(BorderSide(
color: Color(0xffe1e1e1),
width: 0.4,
)),
color: Color(0xff339933),
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
children: [
Container(
child: Texts(
"Riyal Balance",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
],
),
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(
vertical: 8),
child: Column(
mainAxisAlignment:
MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Texts(
"0",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.white,
),
],
),
),
)
],
),
),
],
),
Container(
margin: EdgeInsets.only(top: 16),
child: TextField(
controller: _beneficieryAccountController,
decoration: new InputDecoration(
hintText: 'Enter Beneficiary Account No.',
),
style: TextStyle(
fontSize: 16,
color: Colors.grey.shade700,
),
),
),
Container(
margin: EdgeInsets.only(top: 4),
child: BorderedButton(
TranslationBase.of(context).checkBeneficiary,
backgroundColor:
_beneficieryAccountController.text != ""
? Color(0xff60686b)
: Color(0xffb0b4b5),
textColor: Colors.white,
fontSize: 16,
hPadding: 8,
vPadding: 12,
handler:
_beneficieryAccountController.text != ""
? () {
model.getLacumGroupDataBuAccountId(
_beneficieryAccountController
.text);
}
: null,
),
),
(model.lacumReceiverInformation != null &&
model.lacumReceiverInformation
.lakumInquiryInformationObjVersion !=
null)
? Container(
margin: EdgeInsets.only(top: 8),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context)
.beneficiaryName,
color: Colors.black,
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8),
child: TextField(
enabled: false,
decoration: new InputDecoration(
hintText:
"${model.lacumReceiverInformation.lakumInquiryInformationObjVersion.memberName}",
hintStyle: TextStyle(
fontSize: 16,
color: Colors.grey.shade600,
)),
style: TextStyle(
fontSize: 16,
color: Colors.grey.shade700,
),
),
),
SizedBox(
height: 10,
width: double.infinity,
),
Texts(
"Point's to Transfer :",
color: Colors.black,
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8),
child: TextField(
controller:
_transferPointsController,
decoration: new InputDecoration(
focusColor: Colors.green,
hintStyle: TextStyle(
fontSize: 16,
color: Colors.grey.shade600,
)),
style: TextStyle(
fontSize: 16,
color: Colors.grey.shade700,
),
),
),
],
),
)
: Container()
],
),
if (model.lacumReceiverInformation != null &&
model.lacumReceiverInformation
.lakumInquiryInformationObjVersion !=
null)
Container(
margin: EdgeInsets.all(8),
child: BorderedButton(
"LACUM TRANSFER",
backgroundColor: Color(0xff339933),
textColor: Colors.white,
fontSize: 18,
hPadding: 8,
radius: 12,
vPadding: 16,
fontWeight: FontWeight.w600,
handler: () {
model
.transferYaHalaLoyaltyPoints(
_transferPointsController.text)
.then((status) => {
if (status == 200)
{Navigator.pop(context, "")}
// back to previous page
});
},
),
)
],
),
),
),
),
),
));
}
}