|
|
|
@ -6,7 +6,7 @@ import 'package:diplomaticquarterapp/locator.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/insurance/insurance_details.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
@ -33,26 +33,41 @@ class _InsuranceCardState extends State<InsuranceCard> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
imagesInfo.add(ImagesInfo(
|
|
|
|
|
imageEn:
|
|
|
|
|
'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/en/0.png',
|
|
|
|
|
imageAr:
|
|
|
|
|
'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/ar/0.png'));
|
|
|
|
|
imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/ar/0.png'));
|
|
|
|
|
|
|
|
|
|
return BaseView<InsuranceViewModel>(
|
|
|
|
|
onModelReady: (model) => model.getInsurance(),
|
|
|
|
|
builder: (BuildContext context, InsuranceViewModel model, Widget child) =>
|
|
|
|
|
AppScaffold(
|
|
|
|
|
builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold(
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
showHomeAppBarIcon: false,
|
|
|
|
|
appBarTitle: TranslationBase.of(context).insuranceCards,
|
|
|
|
|
description: TranslationBase.of(context).infoInsuranceCards,
|
|
|
|
|
infoList: TranslationBase.of(context).infoInsuranceCardsPoints,
|
|
|
|
|
imagesInfo: imagesInfo,
|
|
|
|
|
appBarIcons: [
|
|
|
|
|
IconButton(
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
icon: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
),
|
|
|
|
|
margin: EdgeInsets.only(right: 8),
|
|
|
|
|
padding: EdgeInsets.only(right: 4, left: 4),
|
|
|
|
|
child: Image.asset(
|
|
|
|
|
'assets/images/medical/insurance_update_icon_.png',
|
|
|
|
|
height: SizeConfig.heightMultiplier * 5,
|
|
|
|
|
width: SizeConfig.heightMultiplier * 5,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.push(context, FadePage(page: InsuranceUpdate()));
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
body: Container(
|
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
left: SizeConfig.screenWidth * 0.004,
|
|
|
|
|
right: SizeConfig.screenWidth * 0.004,
|
|
|
|
|
top: SizeConfig.screenWidth * 0.04),
|
|
|
|
|
margin: EdgeInsets.only(left: SizeConfig.screenWidth * 0.004, right: SizeConfig.screenWidth * 0.004, top: SizeConfig.screenWidth * 0.04),
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
itemCount: model.insurance == null ? 0 : model.insurance.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
@ -82,23 +97,16 @@ class _InsuranceCardState extends State<InsuranceCard> {
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.all(14),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Colors.grey, width: 0.2),
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(2)),
|
|
|
|
|
boxShadow: [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
color: Colors.white70,
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
decoration: BoxDecoration(shape: BoxShape.rectangle, border: Border.all(color: Colors.grey, width: 0.2), borderRadius: BorderRadius.all(Radius.circular(2)), boxShadow: [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
color: Colors.white70,
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(
|
|
|
|
|
TranslationBase.of(context).companyName +
|
|
|
|
|
model.insurance[index].companyName,
|
|
|
|
|
TranslationBase.of(context).companyName + model.insurance[index].companyName,
|
|
|
|
|
fontSize: 20.0,
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
),
|
|
|
|
@ -108,93 +116,46 @@ class _InsuranceCardState extends State<InsuranceCard> {
|
|
|
|
|
thickness: 0.5,
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.category,
|
|
|
|
|
fontSize: 18.5),
|
|
|
|
|
Texts(
|
|
|
|
|
model.insurance[index]
|
|
|
|
|
.subCategoryDesc,
|
|
|
|
|
fontSize: 18.5)
|
|
|
|
|
],
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [Texts(TranslationBase.of(context).category, fontSize: 18.5), Texts(model.insurance[index].subCategoryDesc, fontSize: 18.5)],
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.expirationDate,
|
|
|
|
|
fontSize: 18.5),
|
|
|
|
|
Texts(TranslationBase.of(context).expirationDate, fontSize: 18.5),
|
|
|
|
|
Texts(
|
|
|
|
|
convertDateFormat(
|
|
|
|
|
model.insurance[index]
|
|
|
|
|
.cardValidTo,
|
|
|
|
|
model.insurance[index].cardValidTo,
|
|
|
|
|
),
|
|
|
|
|
fontSize: 18.5),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.status +
|
|
|
|
|
": ",
|
|
|
|
|
fontSize: 18.5),
|
|
|
|
|
model.insurance[index].isActive ==
|
|
|
|
|
true
|
|
|
|
|
? Texts(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.activeInsurence,
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
fontWeight: FontWeight.w900,
|
|
|
|
|
fontSize: 17.9)
|
|
|
|
|
: Texts(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.notActive,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
fontWeight: FontWeight.w900,
|
|
|
|
|
fontSize: 17.9)
|
|
|
|
|
Texts(TranslationBase.of(context).status + ": ", fontSize: 18.5),
|
|
|
|
|
model.insurance[index].isActive == true
|
|
|
|
|
? Texts(TranslationBase.of(context).activeInsurence, color: Colors.green, fontWeight: FontWeight.w900, fontSize: 17.9)
|
|
|
|
|
: Texts(TranslationBase.of(context).notActive, color: Colors.red, fontWeight: FontWeight.w900, fontSize: 17.9)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.patientCard,
|
|
|
|
|
fontSize: 18.5),
|
|
|
|
|
Texts(
|
|
|
|
|
model.insurance[index]
|
|
|
|
|
.patientCardID,
|
|
|
|
|
fontSize: 18.5)
|
|
|
|
|
],
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [Texts(TranslationBase.of(context).patientCard, fontSize: 18.5), Texts(model.insurance[index].patientCardID, fontSize: 18.5)],
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.policyNumber,
|
|
|
|
|
fontSize: 18.5,
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
model.insurance[index]
|
|
|
|
|
.insurancePolicyNumber,
|
|
|
|
|
fontSize: 18.5,
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
|
|
|
|
Texts(
|
|
|
|
|
TranslationBase.of(context).policyNumber,
|
|
|
|
|
fontSize: 18.5,
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
model.insurance[index].insurancePolicyNumber,
|
|
|
|
|
fontSize: 18.5,
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
@ -204,11 +165,8 @@ class _InsuranceCardState extends State<InsuranceCard> {
|
|
|
|
|
Container(
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
child: SecondaryButton(
|
|
|
|
|
onTap: () => {
|
|
|
|
|
getDetails(model.insurance[index])
|
|
|
|
|
},
|
|
|
|
|
label: TranslationBase.of(context)
|
|
|
|
|
.seeDetails,
|
|
|
|
|
onTap: () => {getDetails(model.insurance[index])},
|
|
|
|
|
label: TranslationBase.of(context).seeDetails,
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
width: double.infinity,
|
|
|
|
@ -235,23 +193,16 @@ class _InsuranceCardState extends State<InsuranceCard> {
|
|
|
|
|
final startIndex = exDate.indexOf(start);
|
|
|
|
|
final endIndex = exDate.indexOf(end, startIndex + start.length);
|
|
|
|
|
|
|
|
|
|
var date = new DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
|
int.parse(exDate.substring(startIndex + start.length, endIndex)));
|
|
|
|
|
String newDate = date.year.toString() +
|
|
|
|
|
"-" +
|
|
|
|
|
date.month.toString().padLeft(2, '0') +
|
|
|
|
|
"-" +
|
|
|
|
|
date.day.toString().padLeft(2, '0');
|
|
|
|
|
var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(exDate.substring(startIndex + start.length, endIndex)));
|
|
|
|
|
String newDate = date.year.toString() + "-" + date.month.toString().padLeft(2, '0') + "-" + date.day.toString().padLeft(2, '0');
|
|
|
|
|
|
|
|
|
|
return newDate.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getDetails(data) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
_insuranceCardService.getInsuranceDetails(data).then((value) => {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context),
|
|
|
|
|
Navigator.push(context,
|
|
|
|
|
FadePage(page: InsuranceCardDetails(data: value[0]['CheckList'])))
|
|
|
|
|
});
|
|
|
|
|
_insuranceCardService
|
|
|
|
|
.getInsuranceDetails(data)
|
|
|
|
|
.then((value) => {GifLoaderDialogUtils.hideDialog(context), Navigator.push(context, FadePage(page: InsuranceCardDetails(data: value[0]['CheckList'])))});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|