Merge branch 'search_text_fields' into 'development'

Search text fields

See merge request Cloud_Solution/doctor_app_flutter!842
merge-requests/843/merge
Mohammad Aljammal 5 years ago
commit 771d94ff4c

@ -15,6 +15,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -91,42 +92,18 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
SizedBox( SizedBox(
height: 20, height: 20,
), ),
Center( AppTextFieldCustomSearch(
child: FractionallySizedBox( searchController: _controller,
widthFactor: .9, onChangeFun: (value) {
child: Container( model.searchData(value);
width: double.maxFinite, },
height: 75, marginTop: 5,
decoration: BoxDecoration( suffixIcon: IconButton(
borderRadius: BorderRadius.all(Radius.circular(6.0)), icon: Icon(
border: Border.all( DoctorApp.filter_1,
width: 1.0, color: Colors.black,
color: Color(0xffCCCCCC), ),
), iconSize: 20,
color: Colors.white),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Padding(
padding: EdgeInsets.only(left: 10, top: 10),
child: AppText(
TranslationBase.of(context).searchPatientName,
fontSize: 13,
)),
AppTextFormField(
// focusNode: focusProject,
controller: _controller,
borderColor: Colors.white,
prefix: IconButton(
icon: Icon(
DoctorApp.filter_1,
color: Colors.black,
),
iconSize: 20,
padding: EdgeInsets.only(bottom: 30),
),
onChanged: (String str) {
model.searchData(str);
}),
])),
), ),
), ),
model.state == ViewState.Idle model.state == ViewState.Idle
@ -135,7 +112,8 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
child: model.filterData.isEmpty child: model.filterData.isEmpty
? Center( ? Center(
child: ErrorMessage( child: ErrorMessage(
error: TranslationBase.of(context).youDontHaveAnyPatient, error: TranslationBase.of(context)
.youDontHaveAnyPatient,
), ),
) )
: ListView.builder( : ListView.builder(
@ -146,7 +124,8 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
return Padding( return Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: PatientCard( child: PatientCard(
patientInfo: PatiantInformtion.fromJson(model.filterData[index].toJson()), patientInfo: PatiantInformtion.fromJson(
model.filterData[index].toJson()),
patientType: "0", patientType: "0",
arrivalType: "0", arrivalType: "0",
isFromSearch: false, isFromSearch: false,
@ -154,15 +133,20 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
isFromLiveCare: true, isFromLiveCare: true,
onTap: () { onTap: () {
// TODO change the parameter to daynamic // TODO change the parameter to daynamic
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { Navigator.of(context).pushNamed(
"patient": PatiantInformtion.fromJson(model.filterData[index].toJson()), PATIENTS_PROFILE,
"patientType": "0", arguments: {
"isSearch": false, "patient":
"isInpatient": false, PatiantInformtion.fromJson(
"arrivalType": "0", model.filterData[index]
"isSearchAndOut": false, .toJson()),
"isFromLiveCare": true, "patientType": "0",
}); "isSearch": false,
"isInpatient": false,
"arrivalType": "0",
"isSearchAndOut": false,
"isFromLiveCare": true,
});
}, },
// isFromSearch: widget.isSearch, // isFromSearch: widget.isSearch,
), ),

@ -16,6 +16,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
@ -138,23 +139,14 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
), ),
FractionallySizedBox( FractionallySizedBox(
widthFactor: 0.9, widthFactor: 0.9,
child: Container( child: AppTextFieldCustomSearch(
decoration: BoxDecoration( hintText:
borderRadius: BorderRadius.all(Radius.circular(6.0)), TranslationBase.of(context).searchMedicineNameHere,
border: Border.all( searchController: myController,
width: 1.0, color: HexColor("#CCCCCC"))), onFieldSubmitted: (value) {
padding: EdgeInsets.all(10), searchMedicine(context, model);
child: AppTextFormField( },
borderColor: Colors.white, marginTop: 5,
hintText:
TranslationBase.of(context).searchMedicineNameHere,
controller: myController,
onSaved: (value) {},
onFieldSubmitted: (value) {
searchMedicine(context, model);
},
inputFormatter: ONLY_LETTERS,
),
), ),
), ),
SizedBox( SizedBox(
@ -226,7 +218,9 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
["ItemID"], ["ItemID"],
url: model.pharmacyItemsList[index] url: model.pharmacyItemsList[index]
["ImageSRCUrl"]), ["ImageSRCUrl"]),
settings: RouteSettings(name: 'PharmaciesListScreen'),), settings: RouteSettings(
name: 'PharmaciesListScreen'),
),
); );
}, },
); );

@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -24,326 +25,396 @@ class _DischargedPatientState extends State<DischargedPatient> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<DischargedPatientViewModel>( return BaseView<DischargedPatientViewModel>(
onModelReady: (model) => model.getDischargedPatient(), onModelReady: (model) => model.getDischargedPatient(),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
//appBarTitle: 'Discharged Patient', //appBarTitle: 'Discharged Patient',
//subtitle: "Last Three Months", //subtitle: "Last Three Months",
backgroundColor: Colors.grey[200], backgroundColor: Colors.grey[200],
isShowAppBar: false, isShowAppBar: false,
baseViewModel: model, baseViewModel: model,
body: model.myDischargedPatient.isEmpty? Center( body: model.myDischargedPatient.isEmpty
child: Column( ? Center(
crossAxisAlignment: CrossAxisAlignment.center, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.center,
Container( children: [
height: MediaQuery.of(context).size.height * 0.070, Container(
), height: MediaQuery.of(context).size.height * 0.070,
SizedBox( ),
height: 100, SizedBox(
), height: 100,
Image.asset('assets/images/no-data.png'), ),
Padding( Image.asset('assets/images/no-data.png'),
padding: const EdgeInsets.all(8.0), Padding(
child: AppText( padding: const EdgeInsets.all(8.0),
'No Discharged Patient',
color: Theme.of(context).errorColor,
),
)
],
),
):Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: MediaQuery.of(context).size.height * 0.070,
),
SizedBox(height: 12,),
Container(
width: double.maxFinite,
height: 75,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: Color(0xffCCCCCC),
),
color: Colors.white),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(
left: 10, top: 10),
child: AppText( child: AppText(
TranslationBase.of( 'No Discharged Patient',
context) color: Theme.of(context).errorColor,
.searchPatientName, ),
fontSize: 13, )
)), ],
AppTextFormField( ),
// focusNode: focusProject, )
controller: _controller, : Padding(
borderColor: Colors.white, padding: const EdgeInsets.all(8.0),
prefix: IconButton( child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: MediaQuery.of(context).size.height * 0.070,
),
SizedBox(
height: 12,
),
AppTextFieldCustomSearch(
searchController: _controller,
onChangeFun: (value) {
model.searchData(value);
},
marginTop: 5,
suffixIcon: IconButton(
icon: Icon( icon: Icon(
DoctorApp.filter_1, DoctorApp.filter_1,
color: Colors.black, color: Colors.black,
), ),
iconSize: 20, iconSize: 20,
padding:
EdgeInsets.only(
bottom: 30),
), ),
onChanged: (String str) { ),
model.searchData(str); SizedBox(
}), height: 5,
])), ),
SizedBox(height: 5,), Expanded(
Expanded(child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
...List.generate(model.filterData.length, (index) => InkWell( ...List.generate(
onTap: () { model.filterData.length,
Navigator.of(context) (index) => InkWell(
.pushNamed( onTap: () {
PATIENTS_PROFILE, Navigator.of(context).pushNamed(
arguments: { PATIENTS_PROFILE,
"patient": model.filterData[index], arguments: {
"patientType": "1", "patient":
"isSearch": false, model.filterData[index],
"isInpatient":true, "patientType": "1",
"isDischargedPatient":true "isSearch": false,
}); "isInpatient": true,
"isDischargedPatient": true
}, });
child: Container( },
width: double.maxFinite, child: Container(
margin: EdgeInsets.all(8), width: double.maxFinite,
padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), margin: EdgeInsets.all(8),
decoration: BoxDecoration( padding: EdgeInsets.only(
borderRadius: BorderRadius.circular(15), left: 0,
color: Colors.white, right: 5,
), bottom: 5,
child: Column( top: 5),
children: [ decoration: BoxDecoration(
Padding( borderRadius:
padding: EdgeInsets.only(left: 12.0), BorderRadius.circular(15),
child: Row( color: Colors.white,
mainAxisAlignment: MainAxisAlignment.spaceBetween, ),
children: [ child: Column(
Row(children: [ children: [
Container( Padding(
width: 170, padding: EdgeInsets.only(
child: AppText( left: 12.0),
(Helpers.capitalize(model child: Row(
.filterData[index] mainAxisAlignment:
.firstName) + MainAxisAlignment
" " + .spaceBetween,
Helpers.capitalize(model children: [
.filterData[index] Row(children: [
.lastName)), Container(
fontSize: 16, width: 170,
fontWeight: FontWeight.bold, child: AppText(
fontFamily: 'Poppins', (Helpers.capitalize(model
textOverflow: TextOverflow.ellipsis, .filterData[
), index]
), .firstName) +
model.filterData[index].gender == 1 " " +
? Icon( Helpers.capitalize(model
DoctorApp.male_2, .filterData[
color: Colors.blue, index]
) .lastName)),
: Icon( fontSize: 16,
DoctorApp.female_1, fontWeight:
color: Colors.pink, FontWeight
), .bold,
]), fontFamily:
Row( 'Poppins',
children: [ textOverflow:
AppText( TextOverflow
model.filterData[index].nationalityName != null .ellipsis,
? model.filterData[index].nationalityName.trim() ),
: model.filterData[index].nationality != null ),
? model.filterData[index].nationality.trim() model.filterData[index]
: model.filterData[index].nationalityId != null .gender ==
? model.filterData[index].nationalityId 1
: "", ? Icon(
fontWeight: FontWeight.bold, DoctorApp
fontSize: 14, .male_2,
textOverflow: TextOverflow.ellipsis, color: Colors
), .blue,
model.filterData[index] )
.nationality != : Icon(
null || DoctorApp
model.filterData[index] .female_1,
.nationalityId != color: Colors
null .pink,
? ClipRRect( ),
borderRadius: ]),
BorderRadius.circular(20.0), Row(
child: Image.network( children: [
model.filterData[index].nationalityFlagURL != null ? AppText(
model.filterData[index].nationalityFlagURL model.filterData[index].nationalityName !=
: '', null
height: 25, ? model
width: 30, .filterData[
errorBuilder: index]
(BuildContext context, .nationalityName
Object exception, .trim()
StackTrace stackTrace) { : model.filterData[index].nationality !=
return AppText( null
'', ? model
fontSize: 10, .filterData[
); index]
}, .nationality
)) .trim()
: SizedBox() : model.filterData[index].nationalityId !=
], null
) ? model.filterData[index].nationalityId
], : "",
)), fontWeight:
Row( FontWeight
children: <Widget>[ .bold,
Column( fontSize: 14,
mainAxisAlignment: MainAxisAlignment.start, textOverflow:
children: <Widget>[ TextOverflow
Padding( .ellipsis,
padding: EdgeInsets.only(left: 12.0), ),
child: Container( model.filterData[index].nationality !=
width: 60, null ||
height: 60, model.filterData[index].nationalityId !=
child: Image.asset( null
model.filterData[index].gender == ? ClipRRect(
1 borderRadius:
? 'assets/images/male_avatar.png' BorderRadius.circular(
: 'assets/images/female_avatar.png', 20.0),
fit: BoxFit.cover, child: Image
), .network(
), model.filterData[index].nationalityFlagURL !=
), null
], ? model.filterData[index].nationalityFlagURL
), : '',
SizedBox( height:
width: 10, 25,
), width:
Expanded( 30,
child: Column( errorBuilder: (BuildContext context,
crossAxisAlignment: CrossAxisAlignment.start, Object
children: [ exception,
Container( StackTrace
child: RichText( stackTrace) {
text: new TextSpan( return AppText(
style: new TextStyle( '',
fontSize: fontSize:
2.0 * SizeConfig.textMultiplier, 10,
color: Colors.black), );
children: <TextSpan>[ },
new TextSpan( ))
text: TranslationBase.of(context) : SizedBox()
.fileNumber, ],
style: TextStyle( )
fontSize: 14, ],
fontFamily: 'Poppins')), )),
new TextSpan( Row(
text: model children: <Widget>[
.filterData[index] Column(
.patientId mainAxisAlignment:
.toString(), MainAxisAlignment
style: TextStyle( .start,
fontWeight: FontWeight.w700, children: <Widget>[
fontFamily: 'Poppins', Padding(
fontSize: 15)), padding:
], EdgeInsets.only(
), left: 12.0),
), child: Container(
), width: 60,
Container( height: 60,
child: RichText( child:
text: new TextSpan( Image.asset(
style: new TextStyle( model.filterData[index]
fontSize: .gender ==
2.0 * SizeConfig.textMultiplier, 1
color: Colors.black, ? 'assets/images/male_avatar.png'
fontFamily: 'Poppins', : 'assets/images/female_avatar.png',
), fit: BoxFit
children: <TextSpan>[ .cover,
new TextSpan( ),
text: model.filterData[index].admissionDate == null ? "" : ),
TranslationBase.of(context).admissionDate + " : ", ),
style: TextStyle(fontSize: 14)), ],
new TextSpan( ),
text: model.filterData[index].admissionDate == null ? "" SizedBox(
: "${AppDateUtils.convertDateFromServerFormat(model.filterData[index].admissionDate.toString(), 'yyyy-MM-dd')}", width: 10,
style: TextStyle( ),
fontWeight: FontWeight.w700, Expanded(
fontSize: 15)), child: Column(
], crossAxisAlignment:
), CrossAxisAlignment
), .start,
), children: [
Container( Container(
child: RichText( child: RichText(
text: new TextSpan( text:
style: new TextStyle( new TextSpan(
fontSize: style: new TextStyle(
2.0 * SizeConfig.textMultiplier, fontSize: 2.0 *
color: Colors.black, SizeConfig
fontFamily: 'Poppins', .textMultiplier,
color: Colors
.black),
children: <
TextSpan>[
new TextSpan(
text: TranslationBase.of(context)
.fileNumber,
style: TextStyle(
fontSize:
14,
fontFamily:
'Poppins')),
new TextSpan(
text: model
.filterData[
index]
.patientId
.toString(),
style: TextStyle(
fontWeight: FontWeight
.w700,
fontFamily:
'Poppins',
fontSize:
15)),
],
),
),
),
Container(
child: RichText(
text:
new TextSpan(
style:
new TextStyle(
fontSize: 2.0 *
SizeConfig
.textMultiplier,
color: Colors
.black,
fontFamily:
'Poppins',
),
children: <
TextSpan>[
new TextSpan(
text: model.filterData[index].admissionDate ==
null
? ""
: TranslationBase.of(context).admissionDate +
" : ",
style: TextStyle(
fontSize:
14)),
new TextSpan(
text: model.filterData[index].admissionDate ==
null
? ""
: "${AppDateUtils.convertDateFromServerFormat(model.filterData[index].admissionDate.toString(), 'yyyy-MM-dd')}",
style: TextStyle(
fontWeight:
FontWeight.w700,
fontSize: 15)),
],
),
),
),
Container(
child: RichText(
text:
new TextSpan(
style:
new TextStyle(
fontSize: 2.0 *
SizeConfig
.textMultiplier,
color: Colors
.black,
fontFamily:
'Poppins',
),
children: <
TextSpan>[
new TextSpan(
text: model.filterData[index].dischargeDate ==
null
? ""
: "Discharge Date : ",
style: TextStyle(
fontSize:
14)),
new TextSpan(
text: model.filterData[index].dischargeDate ==
null
? ""
: "${AppDateUtils.convertDateFromServerFormat(model.filterData[index].dischargeDate.toString(), 'yyyy-MM-dd')}",
style: TextStyle(
fontWeight:
FontWeight.w700,
fontSize: 15)),
],
),
),
),
Row(
children: [
AppText(
"${TranslationBase.of(context).numOfDays}: ",
fontSize: 14,
fontWeight:
FontWeight
.w300,
),
AppText(
"${AppDateUtils.convertStringToDate(model.filterData[index].dischargeDate).difference(AppDateUtils.getDateTimeFromServerFormat(model.filterData[index].admissionDate)).inDays + 1}",
fontSize:
15,
fontWeight:
FontWeight
.w700),
],
),
],
),
),
Icon(
Icons.arrow_forward,
size: 24,
),
],
)
],
),
), ),
children: <TextSpan>[ )),
new TextSpan( ],
text: model.filterData[index].dischargeDate == null ? "" ),
: "Discharge Date : ", ),
style: TextStyle(fontSize: 14)), ),
new TextSpan( ],
text: model.filterData[index].dischargeDate == null ? ""
: "${AppDateUtils.convertDateFromServerFormat(model.filterData[index].dischargeDate.toString(), 'yyyy-MM-dd')}",
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 15)),
],
),
),
),
Row(
children: [
AppText(
"${TranslationBase.of(context).numOfDays}: ",
fontSize: 14,fontWeight: FontWeight.w300,
),
AppText(
"${AppDateUtils.convertStringToDate(model.filterData[index].dischargeDate).difference(AppDateUtils.getDateTimeFromServerFormat(model.filterData[index].admissionDate)).inDays + 1}",
fontSize: 15,
fontWeight: FontWeight.w700),
],
),
],
),
),
Icon(
Icons.arrow_forward,
size: 24,
),
],
)
],
),
), ),
)), ),
], ));
),
),
),],
),
),)
);
} }
} }

@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
@ -140,57 +141,35 @@ class _InPatientListPageState extends State<InPatientListPage> {
], ],
), ),
), ),
Container( AppTextFieldCustomSearch(
margin: EdgeInsets.only( searchController: _searchController,
left: 16, onChangeFun: (value) {
right: 16, setState(() {
bottom: 16, hasQuery = true;
top: widget.isMyInPatient ? 15 : 5), });
child: Stack( widget.patientSearchViewModel.filterSearchResults(value,
children: [ isAllClinic: widget.isAllClinic,
AppTextFieldCustom( isMyInPatient: widget.isMyInPatient);
hintText: TranslationBase.of(context).searchPatientName, },
isTextFieldHasSuffix: true, marginTop: widget.isMyInPatient ? 15 : 5,
suffixIcon: IconButton( positionedChild: IconButton(
icon: Icon( icon: Icon(
Icons.search, isSortDes
color: Colors.black, ? FontAwesomeIcons.sortAmountDown
), : FontAwesomeIcons.sortAmountUp,
onPressed: () {}, color: Colors.black,
), ),
controller: _searchController, iconSize: 20,
onChanged: (value) { // padding: EdgeInsets.only(bottom: 30),
setState(() { onPressed: () {
hasQuery = true; GifLoaderDialogUtils.showMyDialog(context);
}); widget.patientSearchViewModel.sortInPatient(
widget.patientSearchViewModel.filterSearchResults(value, isDes: isSortDes,
isAllClinic: widget.isAllClinic, isAllClinic: widget.isAllClinic,
isMyInPatient: widget.isMyInPatient); isMyInPatient: widget.isMyInPatient);
}), isSortDes = !isSortDes;
Positioned( GifLoaderDialogUtils.hideDialog(context);
right: 35, },
top: 5,
child: IconButton(
icon: Icon(
isSortDes
? FontAwesomeIcons.sortAmountDown
: FontAwesomeIcons.sortAmountUp,
color: Colors.black,
),
iconSize: 20,
// padding: EdgeInsets.only(bottom: 30),
onPressed: () {
GifLoaderDialogUtils.showMyDialog(context);
widget.patientSearchViewModel.sortInPatient(
isDes: isSortDes,
isAllClinic: widget.isAllClinic,
isMyInPatient: widget.isMyInPatient);
isSortDes = !isSortDes;
GifLoaderDialogUtils.hideDialog(context);
},
),
)
],
), ),
), ),
widget.patientSearchViewModel.state == ViewState.Idle widget.patientSearchViewModel.state == ViewState.Idle

@ -17,6 +17,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -105,13 +106,15 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
Container( Container(
// color: Colors.red, // color: Colors.red,
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC), decoration: TextFieldsUtils.containerBorderDecoration(
Color(0Xffffffff), Color(0xFFCCCCCC),
borderRadius: 4, borderWidth: 0), borderRadius: 4, borderWidth: 0),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: _times.map((item) { children: _times.map((item) {
bool _isActive = _times[_activeLocation] == item ? true : false; bool _isActive =
_times[_activeLocation] == item ? true : false;
return Expanded( return Expanded(
child: InkWell( child: InkWell(
@ -131,7 +134,8 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
await model.getPatientBasedOnDate( await model.getPatientBasedOnDate(
item: item, item: item,
selectedPatientType: widget.selectedPatientType, selectedPatientType: widget.selectedPatientType,
patientSearchRequestModel: widget.patientSearchRequestModel, patientSearchRequestModel:
widget.patientSearchRequestModel,
isSearchWithKeyInfo: widget.isSearchWithKeyInfo, isSearchWithKeyInfo: widget.isSearchWithKeyInfo,
outPatientFilterType: outPatientFilterType); outPatientFilterType: outPatientFilterType);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
@ -139,11 +143,16 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
child: Center( child: Center(
child: Container( child: Container(
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration( decoration:
_isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA), TextFieldsUtils.containerBorderDecoration(
_isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), _isActive
borderRadius: 4, ? Color(0xFFD02127 /*B8382B*/)
borderWidth: 0), : Color(0xFFEAEAEA),
_isActive
? Color(0xFFD02127)
: Color(0xFFEAEAEA),
borderRadius: 4,
borderWidth: 0),
child: Center( child: Center(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -151,16 +160,22 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
AppText( AppText(
item, item,
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier * 1.8,
color: _isActive ? Colors.white : Color(0xFF2B353E), color: _isActive
? Colors.white
: Color(0xFF2B353E),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
_isActive && _activeLocation != 0 && model.state == ViewState.Idle _isActive &&
_activeLocation != 0 &&
model.state == ViewState.Idle
? Container( ? Container(
padding: EdgeInsets.all(2), padding: EdgeInsets.all(2),
margin: EdgeInsets.symmetric(horizontal: 5), margin: EdgeInsets.symmetric(
horizontal: 5),
decoration: new BoxDecoration( decoration: new BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(50), borderRadius:
BorderRadius.circular(50),
), ),
constraints: BoxConstraints( constraints: BoxConstraints(
minWidth: 20, minWidth: 20,
@ -168,7 +183,9 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
), ),
child: new Text( child: new Text(
model.filterData.length.toString(), model.filterData.length.toString(),
style: new TextStyle(color: Colors.red, fontSize: 10), style: new TextStyle(
color: Colors.red,
fontSize: 10),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
) )
@ -184,69 +201,50 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
), ),
), ),
SizedBox(height: 18.5), SizedBox(height: 18.5),
Container( AppTextFieldCustomSearch(
width: SizeConfig.screenWidth * 0.9, searchController: _controller,
height: 85, onChangeFun: (value) {
decoration: BoxDecoration( model.searchData(value);
borderRadius: BorderRadius.all(Radius.circular(6.0)), },
border: Border.all( marginTop: 5,
width: 1.0, suffixIcon: IconButton(
color: HexColor("#CCCCCC"), icon: Icon(
), _activeLocation != 0
color: Colors.white), ? DoctorApp.filter_1
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ : FontAwesomeIcons.slidersH,
Padding( color: Colors.black,
padding: EdgeInsets.only(left: 10, top: 10), ),
child: AppText( iconSize: 20,
TranslationBase.of(context).searchPatientName, onPressed: _activeLocation != 0
fontSize: 13, ? null
)), : () {
Stack( Navigator.push(
children: [ context,
AppTextFormField( MaterialPageRoute(
// focusNode: focusProject, builder: (BuildContext context) =>
controller: _controller, FilterDatePage(
borderColor: Colors.white, outPatientFilterType: outPatientFilterType,
prefix: IconButton( patientSearchViewModel: model,
icon: Icon( ),
_activeLocation != 0 ? DoctorApp.filter_1 : FontAwesomeIcons.slidersH, settings: RouteSettings(
color: Colors.black, name: 'FilterOutPatentDateScreen'),
), ));
iconSize: 20, },
padding: EdgeInsets.only(bottom: 30), ),
onPressed: _activeLocation != 0 positionedChild: IconButton(
? null icon: Icon(
: () { isSortDes
Navigator.push( ? FontAwesomeIcons.sortAmountDown
context, : FontAwesomeIcons.sortAmountUp,
MaterialPageRoute( color: Colors.black,
builder: (BuildContext context) => FilterDatePage( ),
outPatientFilterType: outPatientFilterType, iconSize: 20,
patientSearchViewModel: model, onPressed: () {
),settings: RouteSettings(name: 'FilterOutPatentDateScreen'),)); model.sortOutPatient(isDes: isSortDes);
}, isSortDes = !isSortDes;
), },
onChanged: (String str) { ),
model.searchData(str); ),
}),
Positioned(
right: 25,
child: IconButton(
icon: Icon(
isSortDes ? FontAwesomeIcons.sortAmountDown : FontAwesomeIcons.sortAmountUp,
color: Colors.black,
),
iconSize: 20,
padding: EdgeInsets.only(bottom: 30),
onPressed: () {
model.sortOutPatient(isDes: isSortDes);
isSortDes = !isSortDes;
},
),
)
],
),
])),
SizedBox( SizedBox(
height: 10.0, height: 10.0,
), ),
@ -255,7 +253,8 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
child: model.filterData.isEmpty child: model.filterData.isEmpty
? Center( ? Center(
child: ErrorMessage( child: ErrorMessage(
error: TranslationBase.of(context).youDontHaveAnyPatient, error: TranslationBase.of(context)
.youDontHaveAnyPatient,
), ),
) )
: ListView.builder( : ListView.builder(
@ -264,8 +263,11 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
itemCount: model.filterData.length, itemCount: model.filterData.length,
itemBuilder: (BuildContext ctxt, int index) { itemBuilder: (BuildContext ctxt, int index) {
if (_activeLocation != 0 || if (_activeLocation != 0 ||
(model.filterData[index].patientStatusType != null && (model.filterData[index].patientStatusType !=
model.filterData[index].patientStatusType == 43)) null &&
model.filterData[index]
.patientStatusType ==
43))
return Padding( return Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: PatientCard( child: PatientCard(
@ -276,16 +278,20 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
isInpatient: widget.isInpatient, isInpatient: widget.isInpatient,
onTap: () { onTap: () {
// TODO change the parameter to daynamic // TODO change the parameter to daynamic
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { Navigator.of(context).pushNamed(
"patient": model.filterData[index], PATIENTS_PROFILE,
"patientType": "1", arguments: {
"from": widget.patientSearchRequestModel.from, "patient": model.filterData[index],
"to": widget.patientSearchRequestModel.from, "patientType": "1",
"isSearch": false, "from": widget
"isInpatient": false, .patientSearchRequestModel.from,
"arrivalType": "7", "to": widget
"isSearchAndOut": false, .patientSearchRequestModel.from,
}); "isSearch": false,
"isInpatient": false,
"arrivalType": "7",
"isSearchAndOut": false,
});
}, },
// isFromSearch: widget.isSearch, // isFromSearch: widget.isSearch,
), ),

@ -14,6 +14,7 @@ import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dar
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
@ -81,41 +82,21 @@ class _PatientsSearchResultScreenState
body: Column( body: Column(
children: [ children: [
SizedBox(height: 18.5), SizedBox(height: 18.5),
Container( AppTextFieldCustomSearch(
width: SizeConfig.screenWidth * 0.9, searchController: _controller,
height: 75, onChangeFun: (value) {
decoration: BoxDecoration( model.searchData(value);
borderRadius: BorderRadius.all(Radius.circular(6.0)), },
border: Border.all( marginTop: 5,
width: 1.0, suffixIcon: IconButton(
color: HexColor("#CCCCCC"), icon: Icon(
), DoctorApp.filter_1,
color: Colors.white), color: Colors.black,
child: Column( ),
crossAxisAlignment: CrossAxisAlignment.start, iconSize: 20,
children: [ // padding: EdgeInsets.only(bottom: 30),
Padding( ),
padding: EdgeInsets.only(left: 10, top: 10), ),
child: AppText(
TranslationBase.of(context).searchPatientName,
fontSize: 13,
)),
AppTextFormField(
// focusNode: focusProject,
controller: _controller,
borderColor: Colors.white,
prefix: IconButton(
icon: Icon(
DoctorApp.filter_1,
color: Colors.black,
),
iconSize: 20,
padding: EdgeInsets.only(bottom: 30),
),
onChanged: (String str) {
model.searchData(str);
}),
])),
SizedBox( SizedBox(
height: 10.0, height: 10.0,
), ),

@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -47,7 +48,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
BottomSheetTitle( BottomSheetTitle(
title: TranslationBase.of(context).searchPatient), title: TranslationBase.of(context).searchPatient),
FractionallySizedBox( FractionallySizedBox(
widthFactor: 0.9, // widthFactor: 0.9,
child: Container( child: Container(
color: Theme.of(context).scaffoldBackgroundColor, color: Theme.of(context).scaffoldBackgroundColor,
child: Column( child: Column(
@ -59,35 +60,25 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustomSearch(
margin: searchController: patientFileInfoController,
EdgeInsets.only(left: 0, right: 0, top: 15), onChangeFun: (value) {},
child: AppTextFieldCustom( marginTop: 5,
hintText: TranslationBase.of(context) inputFormatters: [
.patpatientIDMobilenationalientID, FilteringTextInputFormatter.allow(
isTextFieldHasSuffix: false, RegExp(ONLY_NUMBERS))
maxLines: 1, ],
minLines: 1, inputType: TextInputType.number,
inputType: TextInputType.number, validationError: (isFormSubmitted &&
hasBorder: true, (patientFileInfoController.text.isEmpty &&
controller: patientFileInfoController, firstNameInfoController
inputFormatters: [ .text.isEmpty &&
FilteringTextInputFormatter.allow( middleNameInfoController
RegExp(ONLY_NUMBERS)) .text.isEmpty &&
], lastNameFileInfoController
onChanged: (_) {}, .text.isEmpty))
validationError: (isFormSubmitted && ? TranslationBase.of(context).emptyMessage
(patientFileInfoController : null,
.text.isEmpty &&
firstNameInfoController
.text.isEmpty &&
middleNameInfoController
.text.isEmpty &&
lastNameFileInfoController
.text.isEmpty))
? TranslationBase.of(context).emptyMessage
: null,
),
), ),
SizedBox( SizedBox(
height: 5, height: 5,

@ -45,7 +45,8 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
AuthenticationViewModel authenticationViewModel; AuthenticationViewModel authenticationViewModel;
ProjectViewModel projectViewModel; ProjectViewModel projectViewModel;
getProgressNoteList(BuildContext context, PatientViewModel model, {bool isLocalBusy = false}) async { getProgressNoteList(BuildContext context, PatientViewModel model,
{bool isLocalBusy = false}) async {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
String token = await sharedPref.getString(TOKEN); String token = await sharedPref.getString(TOKEN);
@ -60,7 +61,10 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
tokenID: token, tokenID: token,
patientTypeID: patient.patientType, patientTypeID: patient.patientType,
languageID: 2); languageID: 2);
model.getPatientProgressNote(progressNoteRequest.toJson(), isLocalBusy: isLocalBusy).then((c) { model
.getPatientProgressNote(progressNoteRequest.toJson(),
isLocalBusy: isLocalBusy)
.then((c) {
notesList = model.patientProgressNoteList; notesList = model.patientProgressNoteList;
}); });
} }
@ -72,7 +76,8 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
String arrivalType = routeArgs['arrivalType']; String arrivalType = routeArgs['arrivalType'];
if (routeArgs.containsKey('isDischargedPatient')) isDischargedPatient = routeArgs['isDischargedPatient']; if (routeArgs.containsKey('isDischargedPatient'))
isDischargedPatient = routeArgs['isDischargedPatient'];
return BaseView<PatientViewModel>( return BaseView<PatientViewModel>(
onModelReady: (model) => getProgressNoteList(context, model), onModelReady: (model) => getProgressNoteList(context, model),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
@ -83,8 +88,10 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
patient, patient,
isInpatient: true, isInpatient: true,
), ),
body: model.patientProgressNoteList == null || model.patientProgressNoteList.length == 0 body: model.patientProgressNoteList == null ||
? DrAppEmbeddedError(error: TranslationBase.of(context).errorNoProgressNote) model.patientProgressNoteList.length == 0
? DrAppEmbeddedError(
error: TranslationBase.of(context).errorNoProgressNote)
: Container( : Container(
color: Colors.grey[200], color: Colors.grey[200],
child: Column( child: Column(
@ -122,60 +129,105 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
widthFactor: 0.95, widthFactor: 0.95,
child: CardWithBgWidget( child: CardWithBgWidget(
hasBorder: false, hasBorder: false,
bgColor: model.patientProgressNoteList[index].status == 1 && bgColor: model.patientProgressNoteList[index]
authenticationViewModel.doctorProfile.doctorID != .status ==
model.patientProgressNoteList[index].createdBy 1 &&
authenticationViewModel
.doctorProfile.doctorID !=
model
.patientProgressNoteList[
index]
.createdBy
? Color(0xFFCC9B14) ? Color(0xFFCC9B14)
: model.patientProgressNoteList[index].status == 4 : model.patientProgressNoteList[index]
.status ==
4
? Colors.red.shade700 ? Colors.red.shade700
: model.patientProgressNoteList[index].status == 2 : model.patientProgressNoteList[index]
.status ==
2
? Colors.green[600] ? Colors.green[600]
: Color(0xFFCC9B14), : Color(0xFFCC9B14),
widget: Column( widget: Column(
children: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
if (model.patientProgressNoteList[index].status == 1 && if (model
authenticationViewModel.doctorProfile.doctorID != .patientProgressNoteList[
model.patientProgressNoteList[index].createdBy) index]
.status ==
1 &&
authenticationViewModel
.doctorProfile.doctorID !=
model
.patientProgressNoteList[
index]
.createdBy)
AppText( AppText(
TranslationBase.of(context).notePending, TranslationBase.of(context)
.notePending,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Color(0xFFCC9B14), color: Color(0xFFCC9B14),
fontSize: 12, fontSize: 12,
), ),
if (model.patientProgressNoteList[index].status == 4) if (model
.patientProgressNoteList[
index]
.status ==
4)
AppText( AppText(
TranslationBase.of(context).noteCanceled, TranslationBase.of(context)
.noteCanceled,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.red.shade700, color: Colors.red.shade700,
fontSize: 12, fontSize: 12,
), ),
if (model.patientProgressNoteList[index].status == 2) if (model
.patientProgressNoteList[
index]
.status ==
2)
AppText( AppText(
TranslationBase.of(context).noteVerified, TranslationBase.of(context)
.noteVerified,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.green[600], color: Colors.green[600],
fontSize: 12, fontSize: 12,
), ),
if (model.patientProgressNoteList[index].status != 2 && if (model.patientProgressNoteList[index].status != 2 &&
model.patientProgressNoteList[index].status != 4 && model
authenticationViewModel.doctorProfile.doctorID == .patientProgressNoteList[
model.patientProgressNoteList[index].createdBy) index]
.status !=
4 &&
authenticationViewModel
.doctorProfile.doctorID ==
model
.patientProgressNoteList[
index]
.createdBy)
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => UpdateNoteOrder( builder: (context) =>
note: model.patientProgressNoteList[index], UpdateNoteOrder(
patientModel: model, note: model
patient: patient, .patientProgressNoteList[
visitType: widget.visitType, index],
patientModel:
model,
patient:
patient,
visitType: widget
.visitType,
isUpdate: true, isUpdate: true,
)), )),
); );
@ -183,7 +235,9 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey[600], color: Colors.grey[600],
borderRadius: BorderRadius.circular(10), borderRadius:
BorderRadius.circular(
10),
), ),
// color:Colors.red[600], // color:Colors.red[600],
@ -198,7 +252,9 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
width: 2, width: 2,
), ),
AppText( AppText(
TranslationBase.of(context).update, TranslationBase.of(
context)
.update,
fontSize: 10, fontSize: 10,
color: Colors.white, color: Colors.white,
), ),
@ -216,33 +272,61 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
context: context, context: context,
actionName: "verify", actionName: "verify",
confirmFun: () async { confirmFun: () async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils
UpdateNoteReqModel reqModel = UpdateNoteReqModel( .showMyDialog(
admissionNo: int.parse(patient.admissionNo), context);
cancelledNote: false, UpdateNoteReqModel
lineItemNo: model.patientProgressNoteList[index].lineItemNo, reqModel =
createdBy: model.patientProgressNoteList[index].createdBy, UpdateNoteReqModel(
notes: model.patientProgressNoteList[index].notes, admissionNo: int
.parse(patient
.admissionNo),
cancelledNote:
false,
lineItemNo: model
.patientProgressNoteList[
index]
.lineItemNo,
createdBy: model
.patientProgressNoteList[
index]
.createdBy,
notes: model
.patientProgressNoteList[
index]
.notes,
verifiedNote: true, verifiedNote: true,
patientTypeID: patient.patientType, patientTypeID:
patient
.patientType,
patientOutSA: false, patientOutSA: false,
); );
await model.updatePatientProgressNote(reqModel); await model
await getProgressNoteList(context, model, isLocalBusy: true); .updatePatientProgressNote(
GifLoaderDialogUtils.hideDialog(context); reqModel);
await getProgressNoteList(
context, model,
isLocalBusy:
true);
GifLoaderDialogUtils
.hideDialog(
context);
}); });
}, },
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.green[600], color: Colors.green[600],
borderRadius: BorderRadius.circular(10), borderRadius:
BorderRadius.circular(
10),
), ),
// color:Colors.red[600], // color:Colors.red[600],
child: Row( child: Row(
children: [ children: [
Icon( Icon(
FontAwesomeIcons.check, FontAwesomeIcons
.check,
size: 12, size: 12,
color: Colors.white, color: Colors.white,
), ),
@ -250,7 +334,9 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
width: 2, width: 2,
), ),
AppText( AppText(
TranslationBase.of(context).noteVerify, TranslationBase.of(
context)
.noteVerify,
fontSize: 10, fontSize: 10,
color: Colors.white, color: Colors.white,
), ),
@ -266,37 +352,66 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
onTap: () async { onTap: () async {
showMyDialog( showMyDialog(
context: context, context: context,
actionName: TranslationBase.of(context).cancel, actionName:
TranslationBase.of(
context)
.cancel,
confirmFun: () async { confirmFun: () async {
GifLoaderDialogUtils.showMyDialog( GifLoaderDialogUtils
.showMyDialog(
context, context,
); );
UpdateNoteReqModel reqModel = UpdateNoteReqModel( UpdateNoteReqModel
admissionNo: int.parse(patient.admissionNo), reqModel =
UpdateNoteReqModel(
admissionNo: int
.parse(patient
.admissionNo),
cancelledNote: true, cancelledNote: true,
lineItemNo: model.patientProgressNoteList[index].lineItemNo, lineItemNo: model
createdBy: model.patientProgressNoteList[index].createdBy, .patientProgressNoteList[
notes: model.patientProgressNoteList[index].notes, index]
.lineItemNo,
createdBy: model
.patientProgressNoteList[
index]
.createdBy,
notes: model
.patientProgressNoteList[
index]
.notes,
verifiedNote: false, verifiedNote: false,
patientTypeID: patient.patientType, patientTypeID:
patient
.patientType,
patientOutSA: false, patientOutSA: false,
); );
await model.updatePatientProgressNote(reqModel); await model
await getProgressNoteList(context, model, isLocalBusy: true); .updatePatientProgressNote(
GifLoaderDialogUtils.hideDialog(context); reqModel);
await getProgressNoteList(
context, model,
isLocalBusy:
true);
GifLoaderDialogUtils
.hideDialog(
context);
}); });
}, },
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.red[600], color: Colors.red[600],
borderRadius: BorderRadius.circular(10), borderRadius:
BorderRadius.circular(
10),
), ),
// color:Colors.red[600], // color:Colors.red[600],
child: Row( child: Row(
children: [ children: [
Icon( Icon(
FontAwesomeIcons.trash, FontAwesomeIcons
.trash,
size: 12, size: 12,
color: Colors.white, color: Colors.white,
), ),
@ -322,25 +437,40 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
height: 10, height: 10,
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.start, MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Container( Container(
width: MediaQuery.of(context).size.width * 0.60, width: MediaQuery.of(context)
.size
.width *
0.60,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment
.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context).createdBy, TranslationBase.of(
context)
.createdBy,
fontSize: 10, fontSize: 10,
), ),
Expanded( Expanded(
child: AppText( child: AppText(
model.patientProgressNoteList[index].doctorName ?? '', model
fontWeight: FontWeight.w600, .patientProgressNoteList[
index]
.doctorName ??
'',
fontWeight:
FontWeight.w600,
fontSize: 12, fontSize: 12,
), ),
), ),
@ -352,40 +482,70 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
Column( Column(
children: [ children: [
AppText( AppText(
model.patientProgressNoteList[index].createdOn != null model
.patientProgressNoteList[
index]
.createdOn !=
null
? AppDateUtils.getDayMonthYearDateFormatted( ? AppDateUtils.getDayMonthYearDateFormatted(
AppDateUtils.getDateTimeFromServerFormat( AppDateUtils
model.patientProgressNoteList[index].createdOn), .getDateTimeFromServerFormat(model
isArabic: projectViewModel.isArabic) .patientProgressNoteList[
: AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(), index]
isArabic: projectViewModel.isArabic), .createdOn),
isArabic:
projectViewModel
.isArabic,
isMonthshort: true)
: AppDateUtils
.getDayMonthYearDateFormatted(
DateTime.now(),
isArabic:
projectViewModel
.isArabic),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 14, fontSize: 14,
), ),
AppText( AppText(
model.patientProgressNoteList[index].createdOn != null model
? AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat( .patientProgressNoteList[
model.patientProgressNoteList[index].createdOn)) index]
: AppDateUtils.getHour(DateTime.now()), .createdOn !=
null
? AppDateUtils.getHour(
AppDateUtils
.getDateTimeFromServerFormat(model
.patientProgressNoteList[
index]
.createdOn))
: AppDateUtils.getHour(
DateTime.now()),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 14, fontSize: 14,
), ),
], ],
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment:
CrossAxisAlignment.end,
) )
], ],
), ),
SizedBox( SizedBox(
height: 8, height: 8,
), ),
Row(mainAxisAlignment: MainAxisAlignment.start, children: [ Row(
Expanded( mainAxisAlignment:
child: AppText( MainAxisAlignment.start,
model.patientProgressNoteList[index].notes, children: [
fontSize: 10, Expanded(
), child: AppText(
), model
]) .patientProgressNoteList[
index]
.notes,
fontSize: 10,
),
),
])
], ],
), ),
SizedBox( SizedBox(

@ -16,9 +16,9 @@ class AppDateUtils {
} }
static String convertStringToDateFormat(String date, String dateFormat) { static String convertStringToDateFormat(String date, String dateFormat) {
DateTime dateTime ; DateTime dateTime;
if(date.contains("/Date")) if (date.contains("/Date"))
dateTime= getDateTimeFromServerFormat(date); dateTime = getDateTimeFromServerFormat(date);
else else
dateTime = DateTime.parse(date); dateTime = DateTime.parse(date);
return convertDateToFormat(dateTime, dateFormat); return convertDateToFormat(dateTime, dateFormat);
@ -41,7 +41,8 @@ class AppDateUtils {
final endIndex = str.indexOf(end, startIndex + start.length); final endIndex = str.indexOf(end, startIndex + start.length);
date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex))); date = new DateTime.fromMillisecondsSinceEpoch(
int.parse(str.substring(startIndex + start.length, endIndex)));
} else { } else {
date = DateTime.now(); date = DateTime.now();
} }
@ -52,7 +53,8 @@ class AppDateUtils {
return date; return date;
} }
static String differenceBetweenDateAndCurrentInYearMonthDay(DateTime firstDate, BuildContext context) { static String differenceBetweenDateAndCurrentInYearMonthDay(
DateTime firstDate, BuildContext context) {
DateTime now = DateTime.now(); DateTime now = DateTime.now();
// now = now.add(Duration(days: 400, minutes: 0)); // now = now.add(Duration(days: 400, minutes: 0));
var difference = firstDate.difference(now); var difference = firstDate.difference(now);
@ -72,13 +74,16 @@ class AppDateUtils {
return "$days ${TranslationBase.of(context).days}, $months ${TranslationBase.of(context).months}, $years ${TranslationBase.of(context).years}"; return "$days ${TranslationBase.of(context).days}, $months ${TranslationBase.of(context).months}, $years ${TranslationBase.of(context).years}";
} }
static String differenceBetweenDateAndCurrent(DateTime firstDate, BuildContext context, {bool isShowSecond = false, bool isShowDays = true }) { static String differenceBetweenDateAndCurrent(
DateTime firstDate, BuildContext context,
{bool isShowSecond = false, bool isShowDays = true}) {
DateTime now = DateTime.now(); DateTime now = DateTime.now();
var difference = now.difference(firstDate); var difference = now.difference(firstDate);
int minutesInDays = difference.inMinutes; int minutesInDays = difference.inMinutes;
int secondInDays = difference.inSeconds; int secondInDays = difference.inSeconds;
int hoursInDays = minutesInDays ~/ 60; // ~/ : truncating division to make the result int int hoursInDays =
minutesInDays ~/ 60; // ~/ : truncating division to make the result int
int second = secondInDays % 60; int second = secondInDays % 60;
int minutes = minutesInDays % 60; int minutes = minutesInDays % 60;
int days = hoursInDays ~/ 24; int days = hoursInDays ~/ 24;
@ -94,7 +99,8 @@ class AppDateUtils {
(isShowSecond ? ", $second Sec" : ""); (isShowSecond ? ", $second Sec" : "");
} }
static String differenceBetweenServerDateAndCurrent(String str, BuildContext context) { static String differenceBetweenServerDateAndCurrent(
String str, BuildContext context) {
const start = "/Date("; const start = "/Date(";
const end = "+0300)"; const end = "+0300)";
@ -103,7 +109,8 @@ class AppDateUtils {
final endIndex = str.indexOf(end, startIndex + start.length); final endIndex = str.indexOf(end, startIndex + start.length);
var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex))); var date = new DateTime.fromMillisecondsSinceEpoch(
int.parse(str.substring(startIndex + start.length, endIndex)));
return differenceBetweenDateAndCurrent(date, context); return differenceBetweenDateAndCurrent(date, context);
} }
@ -262,29 +269,39 @@ class AppDateUtils {
/// [dateTime] convert DateTime to data formatted Arabic /// [dateTime] convert DateTime to data formatted Arabic
static String getMonthDayYearDateFormattedAr(DateTime dateTime) { static String getMonthDayYearDateFormattedAr(DateTime dateTime) {
if (dateTime != null) if (dateTime != null)
return getMonthArabic(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString(); return getMonthArabic(dateTime.month) +
" " +
dateTime.day.toString() +
", " +
dateTime.year.toString();
else else
return ""; return "";
} }
/// get data formatted like Apr 26,2020 /// get data formatted like Apr 26,2020
/// [dateTime] convert DateTime to data formatted /// [dateTime] convert DateTime to data formatted
static String getMonthDayYearDateFormatted(DateTime dateTime, {bool isArabic = false}) { static String getMonthDayYearDateFormatted(DateTime dateTime,
{bool isArabic = false}) {
if (dateTime != null) if (dateTime != null)
return isArabic return isArabic
? getMonthArabic(dateTime.month) ? getMonthArabic(dateTime.month)
: getMonth(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString(); : getMonth(dateTime.month) +
" " +
dateTime.day.toString() +
", " +
dateTime.year.toString();
else else
return ""; return "";
} }
/// get data formatted like 26 Apr 2020 /// get data formatted like 26 Apr 2020
/// [dateTime] convert DateTime to data formatted /// [dateTime] convert DateTime to data formatted
static String getDayMonthYearDateFormatted(DateTime dateTime, {bool isArabic = false}) { static String getDayMonthYearDateFormatted(DateTime dateTime,
{bool isArabic = false, bool isMonthshort = false}) {
if (dateTime != null) if (dateTime != null)
return dateTime.day.toString() + return dateTime.day.toString() +
" " + " " +
"${isArabic ? getMonthArabic(dateTime.month) : getMonth(dateTime.month)}" + "${isArabic ? getMonthArabic(dateTime.month) : isMonthshort ? getMonth(dateTime.month).toString().substring(0, 3) : getMonth(dateTime.month)}" +
" " + " " +
dateTime.year.toString(); dateTime.year.toString();
else else
@ -293,9 +310,14 @@ class AppDateUtils {
/// get data formatted like 26/4/2020 /// get data formatted like 26/4/2020
/// [dateTime] convert DateTime to data formatted /// [dateTime] convert DateTime to data formatted
static String getDayMonthYearDate(DateTime dateTime, {bool isArabic = false}) { static String getDayMonthYearDate(DateTime dateTime,
{bool isArabic = false}) {
if (dateTime != null) if (dateTime != null)
return dateTime.day.toString() + "/" + "${dateTime.month}" + "/" + dateTime.year.toString(); return dateTime.day.toString() +
"/" +
"${dateTime.month}" +
"/" +
dateTime.year.toString();
else else
return ""; return "";
} }
@ -306,7 +328,8 @@ class AppDateUtils {
return DateFormat('hh:mm a').format(dateTime); return DateFormat('hh:mm a').format(dateTime);
} }
static String getAgeByBirthday(String birthOfDate, BuildContext context, {bool isServerFormat = true}) { static String getAgeByBirthday(String birthOfDate, BuildContext context,
{bool isServerFormat = true}) {
// https://leechy.dev/calculate-dates-diff-in-dart // https://leechy.dev/calculate-dates-diff-in-dart
DateTime birthDate; DateTime birthDate;
if (birthOfDate.contains("/Date")) { if (birthOfDate.contains("/Date")) {
@ -331,7 +354,9 @@ class AppDateUtils {
static bool isToday(DateTime dateTime) { static bool isToday(DateTime dateTime) {
DateTime todayDate = DateTime.now().toUtc(); DateTime todayDate = DateTime.now().toUtc();
if (dateTime.day == todayDate.day && dateTime.month == todayDate.month && dateTime.year == todayDate.year) { if (dateTime.day == todayDate.day &&
dateTime.month == todayDate.month &&
dateTime.year == todayDate.year) {
return true; return true;
} }
return false; return false;
@ -340,7 +365,11 @@ class AppDateUtils {
static String getDate(DateTime dateTime) { static String getDate(DateTime dateTime) {
print(dateTime); print(dateTime);
if (dateTime != null) if (dateTime != null)
return getMonth(dateTime.month) + " " + dateTime.day.toString() + "," + dateTime.year.toString(); return getMonth(dateTime.month) +
" " +
dateTime.day.toString() +
"," +
dateTime.year.toString();
else else
return ""; return "";
} }
@ -348,7 +377,11 @@ class AppDateUtils {
static String getDateFormatted(DateTime dateTime) { static String getDateFormatted(DateTime dateTime) {
print(dateTime); print(dateTime);
if (dateTime != null) if (dateTime != null)
return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString(); return dateTime.day.toString() +
"/" +
dateTime.month.toString() +
"/" +
dateTime.year.toString();
else else
return ""; return "";
} }
@ -376,25 +409,23 @@ class AppDateUtils {
return ""; return "";
} }
// handel date like "09/05/2021 17:00" // handel date like "09/05/2021 17:00"
static DateTime getDateTimeFromString(String str) { static DateTime getDateTimeFromString(String str) {
List<String> array = str.split('/'); List<String> array = str.split('/');
int day = int.parse(array[0]); int day = int.parse(array[0]);
int month = int.parse(array[1]); int month = int.parse(array[1]);
List<String> array2 = array[2].split(' '); List<String> array2 = array[2].split(' ');
int year = int.parse(array2[0]); int year = int.parse(array2[0]);
String hour = array2[1]; String hour = array2[1];
List<String> hourList = hour.split(":"); List<String> hourList = hour.split(":");
DateTime date = DateTime(year, month, day, int.parse(hourList[0]), int.parse(hourList[1])); DateTime date = DateTime(
year, month, day, int.parse(hourList[0]), int.parse(hourList[1]));
return date; return date;
} }
static convertDateFormatImproved(String str) { static convertDateFormatImproved(String str) {
String newDate; String newDate;
const start = "/Date("; const start = "/Date(";
@ -413,6 +444,6 @@ class AppDateUtils {
date.day.toString().padLeft(2, '0'); date.day.toString().padLeft(2, '0');
} }
return newDate??''; return newDate ?? '';
} }
} }

@ -24,11 +24,16 @@ class AppTextFieldCustom extends StatefulWidget {
final int maxLines; final int maxLines;
final List<TextInputFormatter> inputFormatters; final List<TextInputFormatter> inputFormatters;
final Function(String) onChanged; final Function(String) onChanged;
final Function onFieldSubmitted;
final String validationError; final String validationError;
final bool isPrscription; final bool isPrscription;
final bool isSecure; final bool isSecure;
final bool focus; final bool focus;
///TODO Rename it to isCustomSearchablFiels
final bool isSearchTextField;
AppTextFieldCustom({ AppTextFieldCustom({
this.height = 0, this.height = 0,
this.onClick, this.onClick,
@ -49,6 +54,8 @@ class AppTextFieldCustom extends StatefulWidget {
this.isPrscription = false, this.isPrscription = false,
this.isSecure = false, this.isSecure = false,
this.focus = false, this.focus = false,
this.isSearchTextField = false,
this.onFieldSubmitted,
}); });
@override @override
@ -109,7 +116,9 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
Expanded( Expanded(
child: Container( child: Container(
padding: widget.dropDownText == null padding: widget.dropDownText == null
? EdgeInsets.symmetric(vertical: 0) ? widget.isSearchTextField
? EdgeInsets.only(top: 10)
: EdgeInsets.symmetric(vertical: 0)
: EdgeInsets.symmetric(vertical: 0), // 8.0 : EdgeInsets.symmetric(vertical: 0), // 8.0
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -120,9 +129,11 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
widget.dropDownText != null) widget.dropDownText != null)
AppText( AppText(
widget.hintText, widget.hintText,
// marginTop: widget.hasHintmargin ? 0 : 30,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontSize: widget.isPrscription == false fontSize: widget.isPrscription == false
? SizeConfig.getHeightMultiplier() * (SizeConfig.isWidthLarge?1.1: 1.3) ? SizeConfig.getHeightMultiplier() *
(SizeConfig.isWidthLarge ? 1.1 : 1.3)
: 0, : 0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
@ -163,6 +174,7 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
widget.onChanged(value); widget.onChanged(value);
} }
}, },
onFieldSubmitted: widget.onFieldSubmitted,
obscureText: widget.isSecure), obscureText: widget.isSecure),
) )
: AppText( : AppText(
@ -177,7 +189,15 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
), ),
widget.isTextFieldHasSuffix widget.isTextFieldHasSuffix
? widget.suffixIcon != null ? widget.suffixIcon != null
? widget.suffixIcon ? Container(
margin: EdgeInsets.only(
bottom: widget.isSearchTextField
? (widget.controller.text.isEmpty ||
widget.controller == null)
? 10
: 25
: 0),
child: widget.suffixIcon)
: InkWell( : InkWell(
child: Icon( child: Icon(
Icons.keyboard_arrow_down, Icons.keyboard_arrow_down,
@ -196,5 +216,4 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
], ],
); );
} }
} }

@ -0,0 +1,66 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'app-textfield-custom.dart';
class AppTextFieldCustomSearch extends StatelessWidget {
const AppTextFieldCustomSearch({
Key key,
this.onChangeFun,
this.positionedChild,
this.marginTop,
this.suffixIcon,
this.validationError,
this.inputType,
this.inputFormatters,
this.searchController,
this.onFieldSubmitted,
this.hintText,
});
final TextEditingController searchController;
final Function onChangeFun;
final Function onFieldSubmitted;
final Widget positionedChild;
final IconButton suffixIcon;
final double marginTop;
final String validationError;
final String hintText;
final TextInputType inputType;
final List<TextInputFormatter> inputFormatters;
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(left: 16, right: 16, bottom: 16, top: marginTop),
child: Stack(
children: [
AppTextFieldCustom(
hintText:
hintText ?? TranslationBase.of(context).searchPatientName,
isTextFieldHasSuffix: true,
isSearchTextField: true,
inputFormatters: inputFormatters,
suffixIcon: suffixIcon ??
IconButton(
icon: Icon(
Icons.search,
color: Colors.black,
),
onPressed: () {},
),
controller: searchController,
onChanged: onChangeFun,
onFieldSubmitted: onFieldSubmitted,
validationError: validationError),
if (positionedChild != null)
Positioned(right: 35, top: 5, child: positionedChild)
],
),
);
}
}
Loading…
Cancel
Save