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.
203 lines
10 KiB
Dart
203 lines
10 KiB
Dart
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart';
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
import 'package:diplomaticquarterapp/widgets/my_rich_text.dart';
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import '../base/base_view.dart';
|
|
import 'insurance_approval_detail_screen.dart';
|
|
|
|
class InsuranceApproval extends StatefulWidget {
|
|
int appointmentNo;
|
|
|
|
InsuranceApproval({this.appointmentNo});
|
|
|
|
@override
|
|
_InsuranceApprovalState createState() => _InsuranceApprovalState();
|
|
}
|
|
|
|
class _InsuranceApprovalState extends State<InsuranceApproval> {
|
|
List<ImagesInfo> imagesInfo = List();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
imagesInfo
|
|
.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/apporvals/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/apporvals/ar/0.png'));
|
|
imagesInfo
|
|
.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/apporvals/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/apporvals/ar/1.png'));
|
|
return BaseView<InsuranceViewModel>(
|
|
onModelReady: widget.appointmentNo != null ? (model) => model.getInsuranceApproval(appointmentNo: widget.appointmentNo) : (model) => model.getInsuranceApproval(),
|
|
builder: (BuildContext _context, InsuranceViewModel model, Widget child) => AppScaffold(
|
|
isShowAppBar: true,
|
|
showNewAppBar: true,
|
|
baseViewModel: model,
|
|
showNewAppBarTitle: true,
|
|
appBarTitle: TranslationBase.of(context).insuranceApprovalSubtitle,
|
|
description: TranslationBase.of(context).infoApprovals,
|
|
infoList: TranslationBase.of(context).infoApprovalPoints,
|
|
imagesInfo: imagesInfo,
|
|
body: model.insuranceApproval.length > 0
|
|
? ListView.separated(
|
|
padding: EdgeInsets.all(21),
|
|
physics: BouncingScrollPhysics(),
|
|
itemBuilder: (_, index) {
|
|
Color _patientStatusColor;
|
|
String _patientStatusString;
|
|
|
|
if (model.insuranceApproval[index].isLiveCareAppointment) {
|
|
_patientStatusColor = Color(0xff2E303A);
|
|
_patientStatusString = TranslationBase.of(context).liveCare.capitalizeFirstofEach;
|
|
} else if (!model.insuranceApproval[index].isInOutPatient) {
|
|
_patientStatusColor = Color(0xffD02127);
|
|
_patientStatusString = TranslationBase.of(context).inPatient.capitalizeFirstofEach;
|
|
} else {
|
|
_patientStatusString = TranslationBase.of(context).outpatient.capitalizeFirstofEach;
|
|
_patientStatusColor = Color(0xffa9a089);
|
|
}
|
|
return InkWell(
|
|
onTap: () {
|
|
Navigator.push(context, FadePage(page: InsuranceApprovalDetail(insuranceApprovalModel: model.insuranceApproval[index])));
|
|
},
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.all(
|
|
Radius.circular(10.0),
|
|
),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Color(0xff000000).withOpacity(.05),
|
|
//spreadRadius: 5,
|
|
blurRadius: 27,
|
|
offset: Offset(0, -3),
|
|
),
|
|
],
|
|
color: _patientStatusColor),
|
|
child: Row(
|
|
children: [
|
|
SizedBox(
|
|
width: 16,
|
|
child: RotatedBox(
|
|
quarterTurns: 3,
|
|
child: Text(
|
|
_patientStatusString,
|
|
style: TextStyle(fontSize: 10, fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Container(
|
|
padding: EdgeInsets.fromLTRB(12, 10, 12, 10),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: Colors.white, width: 1),
|
|
borderRadius: BorderRadius.only(
|
|
bottomRight: Radius.circular(10.0),
|
|
topRight: Radius.circular(10.0),
|
|
),
|
|
color: Colors.white),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
model.insuranceApproval[index].approvalStatusDescption,
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.w600,
|
|
color: model.insuranceApproval[index].status == 9 ? Color(0xff359846) : Color(0xffD02127),
|
|
letterSpacing: -0.4,
|
|
height: 18 / 10),
|
|
),
|
|
Text(
|
|
model.insuranceApproval[index].doctorName,
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
color: Color(0xff2E303A),
|
|
letterSpacing: -0.64,
|
|
),
|
|
),
|
|
SizedBox(height: 6),
|
|
Row(
|
|
children: [
|
|
LargeAvatar(
|
|
name: model.insuranceApproval[index].doctorName,
|
|
url: model.insuranceApproval[index].doctorImageURL,
|
|
width: 48,
|
|
height: 48,
|
|
),
|
|
SizedBox(width: 12),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
MyRichText(TranslationBase.of(context).clinic + ":", model.insuranceApproval[index]?.clinicName.toLowerCase().capitalizeFirstofEach ?? "",
|
|
projectViewModel.isArabic),
|
|
MyRichText(TranslationBase.of(context).approvalNo, model.insuranceApproval[index]?.approvalNo.toString() ?? "", projectViewModel.isArabic),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
height: 48,
|
|
alignment: Alignment.bottomRight,
|
|
child: Icon(
|
|
Icons.arrow_forward,
|
|
color: Color(0xff2E303A),
|
|
),
|
|
)
|
|
],
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
separatorBuilder: (context, index) => SizedBox(height: 12),
|
|
itemCount: model.insuranceApproval.length)
|
|
: getNoDataWidget(context)),
|
|
);
|
|
}
|
|
|
|
Widget sideBadge(String title, int color) {
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
color: Color(color),
|
|
borderRadius: BorderRadius.circular(16.0),
|
|
),
|
|
width: 115.0,
|
|
padding: EdgeInsets.only(top: 1, bottom: 1),
|
|
alignment: Alignment.center,
|
|
child: Texts(
|
|
title,
|
|
color: Colors.white,
|
|
),
|
|
);
|
|
}
|
|
|
|
convertDateFormat(String Date) {
|
|
const start = "/Date(";
|
|
const end = "+0300)";
|
|
|
|
final startIndex = Date.indexOf(start);
|
|
final endIndex = Date.indexOf(end, startIndex + start.length);
|
|
|
|
var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(Date.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();
|
|
}
|
|
}
|