Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into search_out_patient
Conflicts: lib/core/model/PatientSearchRequestModel.dart lib/core/viewModel/PatientSearchViewModel.dart lib/locator.dartmerge-requests/594/head
commit
56a5209d92
@ -0,0 +1,36 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/core/model/PatientSearchRequestModel.dart';
|
||||
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
|
||||
class PatientInPatientService extends BaseService {
|
||||
List<PatiantInformtion> inPatientList = List();
|
||||
|
||||
Future getInPatientList(
|
||||
PatientSearchRequestModel requestModel, bool isMyInpatient) async {
|
||||
hasError = false;
|
||||
await getDoctorProfile();
|
||||
|
||||
if (isMyInpatient) {
|
||||
requestModel.doctorID = doctorProfile.doctorID;
|
||||
}else {
|
||||
requestModel.doctorID = 0;
|
||||
}
|
||||
|
||||
await baseAppClient.post(
|
||||
GET_PATIENT_IN_PATIENT_LIST,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
inPatientList.clear();
|
||||
|
||||
response['List_MyInPatient'].forEach((v) {
|
||||
inPatientList.add(PatiantInformtion.fromJson(v));
|
||||
});
|
||||
},
|
||||
onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
},
|
||||
body: requestModel.toJson(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,189 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/model/PatientSearchRequestModel.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/patients/PatientCard.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/errors/error_message.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../routes.dart';
|
||||
|
||||
class PatientInPatientScreen extends StatefulWidget {
|
||||
@override
|
||||
_PatientInPatientScreenState createState() => _PatientInPatientScreenState();
|
||||
}
|
||||
|
||||
class _PatientInPatientScreenState extends State<PatientInPatientScreen> {
|
||||
PatientSearchRequestModel requestModel = PatientSearchRequestModel();
|
||||
int _activeTab = 0;
|
||||
|
||||
TextEditingController _searchController = TextEditingController();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_searchController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenSize = MediaQuery.of(context).size;
|
||||
|
||||
return BaseView<PatientSearchViewModel>(
|
||||
onModelReady: (model) => model.getInPatientList(requestModel),
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
baseViewModel: model,
|
||||
isShowAppBar: false,
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 10, bottom: 10),
|
||||
margin: EdgeInsets.only(top: 50),
|
||||
child: Row(children: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.arrow_back_ios),
|
||||
color: Colors.black, //Colors.black,
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
TranslationBase.of(context).inPatient,
|
||||
fontSize: SizeConfig.textMultiplier * 2.8,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF2B353E),
|
||||
fontFamily: 'Poppins',
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
tabsBar(context, screenSize, model),
|
||||
model.filteredInPatientItems.length > 0
|
||||
? Expanded(
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(16.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppTextFieldCustom(
|
||||
hintText: TranslationBase.of(context)
|
||||
.searchPatientName,
|
||||
isTextFieldHasSuffix: true,
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
Icons.search,
|
||||
color: Colors.black,
|
||||
),
|
||||
onPressed: () {},
|
||||
),
|
||||
controller: _searchController,
|
||||
onChanged: (value) {
|
||||
model.filterSearchResults(value);
|
||||
}),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
...model.filteredInPatientItems.map((item) {
|
||||
return PatientCard(
|
||||
patientInfo: item,
|
||||
patientType: "1",
|
||||
arrivalType: "1",
|
||||
isInpatient: true,
|
||||
onTap: () {
|
||||
Navigator.of(context)
|
||||
.pushNamed(PATIENTS_PROFILE, arguments: {
|
||||
"patient": item,
|
||||
"patientType": "1",
|
||||
"from": "0",
|
||||
"to": "0",
|
||||
"isSearch": false,
|
||||
"isInpatient": true,
|
||||
"arrivalType": "1",
|
||||
});
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
child: ErrorMessage(
|
||||
error: TranslationBase.of(context).noDataAvailable)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget tabsBar(
|
||||
BuildContext context, Size screenSize, PatientSearchViewModel model) {
|
||||
List<String> _tabs = [
|
||||
TranslationBase.of(context).inPatientAll.toUpperCase(),
|
||||
TranslationBase.of(context).inPatient.toUpperCase(),
|
||||
];
|
||||
|
||||
return Container(
|
||||
height: screenSize.height * 0.070,
|
||||
decoration: TextFieldsUtils.containerBorderDecoration(
|
||||
Color(0Xffffffff), Color(0xFFCCCCCC),
|
||||
borderRadius: 4, borderWidth: 0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: _tabs.map((item) {
|
||||
bool _isActive = _tabs[_activeTab] == item ? true : false;
|
||||
|
||||
return Expanded(
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
setState(() {
|
||||
_activeTab = _tabs.indexOf(item);
|
||||
});
|
||||
// GifLoaderDialogUtils.showMyDialog(
|
||||
// context);
|
||||
await model.getInPatientList(requestModel,
|
||||
isMyInpatient: _activeTab == 1);
|
||||
},
|
||||
child: Center(
|
||||
child: Container(
|
||||
height: screenSize.height * 0.070,
|
||||
decoration: TextFieldsUtils.containerBorderDecoration(
|
||||
_isActive
|
||||
? Color(0xFFD02127 /*B8382B*/)
|
||||
: Color(0xFFEAEAEA),
|
||||
_isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA),
|
||||
borderRadius: 4,
|
||||
borderWidth: 0),
|
||||
child: Center(
|
||||
child: AppText(
|
||||
item,
|
||||
fontSize: SizeConfig.textMultiplier * 1.8,
|
||||
color: _isActive ? Colors.white : Color(0xFF2B353E),
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue