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.
doctor_app_flutter/lib/screens/procedures/procedure_screen.dart

608 lines
40 KiB
Dart

import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.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/screens/procedures/add-procedure-form.dart';
import 'package:doctor_app_flutter/screens/procedures/update-procedure.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-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/network_base_view.dart';
import 'package:flutter/material.dart';
class ProcedureScreen extends StatefulWidget {
@override
_ProcedureScreenState createState() => _ProcedureScreenState();
}
class _ProcedureScreenState extends State<ProcedureScreen> {
int selectedType = 0;
int testNum = 1;
PatiantInformtion patient;
setSelectedType(int val) {
setState(() {
selectedType = val;
});
}
TextEditingController procedureController = TextEditingController();
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
patient = routeArgs['patient'];
return BaseView<ProcedureViewModel>(
onModelReady: (model) => model.getProcedure(mrn: 0),
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).orderProcedure,
body: NetworkBaseView(
baseViewModel: model,
child: SingleChildScrollView(
child: Container(
color: Colors.white,
child: Column(
children: [
PatientPageHeaderWidget(patient),
Divider(
height: 1.0,
thickness: 1.0,
color: Colors.grey,
),
(model.procedureList.length != 0)
? SizedBox(
height: model.procedureList[0].rowcount == 0
? 200.0
: 10.0)
: SizedBox(height: 200.0),
//model.prescriptionList == null
(model.procedureList.length != 0)
? model.procedureList[0].rowcount == 0
? Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.stretch,
children: [
InkWell(
onTap: () {
model
.getProcedureCategory()
.then((value) {
addSelectedProcedure(
context, model, patient);
});
//model.postPrescription();
},
child: CircleAvatar(
radius: 65,
backgroundColor: Color(0XFFB8382C),
child: CircleAvatar(
radius: 60,
backgroundColor: Colors.white,
child: Icon(
Icons.add,
color: Colors.black,
size: 45.0,
),
),
),
),
SizedBox(
height: 15.0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
AppText(
'NO ORDER FOR PROCEDURE LISTED',
color: Colors.black,
fontWeight: FontWeight.w900,
),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
AppText(
TranslationBase.of(context).addNow,
color: Color(0XFFB8382C),
fontWeight: FontWeight.w700,
),
],
),
],
)
: Padding(
padding: EdgeInsets.all(16.0),
child: NetworkBaseView(
baseViewModel: model,
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
InkWell(
child: Container(
height: 50.0,
width: 450.0,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.grey),
borderRadius:
BorderRadius.circular(10.0),
),
child: Padding(
padding: EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
AppText(
TranslationBase.of(
context)
.addMoreProcedure,
fontWeight:
FontWeight.w100,
fontSize: 12.5,
),
Icon(
Icons.add,
color: Color(0XFFB8382C),
)
],
),
),
),
onTap: () {
model
.getProcedureCategory()
.then((value) {
addSelectedProcedure(
context, model, patient);
});
//model.postPrescription();
},
),
// Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.all(
// Radius.circular(6.0)),
// border: Border.all(
// width: 1.0,
// color: HexColor("#CCCCCC"))),
// child: AppTextFormField(
// labelText: 'Add more procedure',
// borderColor: Colors.white,
// //suffixIcon: Icons.search,
//
// //textInputType: TextInputType.number,
// inputFormatter: ONLY_NUMBERS,
// onTap: () {
// addSelectedProcedure(context);
// },
// ),
// ),
SizedBox(
height: 10.0,
),
...List.generate(
model.procedureList[0].rowcount,
(index) => Container(
color: Colors.white,
child: Column(
children: [
SizedBox(
height:
MediaQuery.of(context)
.size
.height *
0.022,
),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Container(
height: MediaQuery.of(
context)
.size
.height *
0.18,
width: MediaQuery.of(
context)
.size
.width *
0.135,
child: Column(
children: [
AppText(
DateTime.parse(model
.procedureList[
0]
.entityList[
index]
.orderDate)
.year
.toString(),
color: model
.procedureList[
0]
.entityList[
index]
.orderType ==
1
? Color(
0xFFB9382C)
: Colors
.green),
AppText(
Helpers.getMonth(model.procedureList[0].entityList[index].orderDate !=
null
? (DateTime.parse(model.procedureList[0].entityList[index].orderDate)
.month)
: DateTime.now()
.month)
.toUpperCase(),
color: model
.procedureList[
0]
.entityList[
index]
.orderType ==
1
? Color(
0xFFB9382C)
: Colors
.green),
AppText(
DateTime.parse(model
.procedureList[
0]
.entityList[
index]
.orderDate)
.day
.toString(),
color: model
.procedureList[
0]
.entityList[
index]
.orderType ==
1
? Color(
0xFFB9382C)
: Colors
.green),
],
),
),
Expanded(
child: Container(
width: MediaQuery.of(
context)
.size
.width *
0.05,
child: Column(
children: [
Row(
children: [
AppText(
TranslationBase.of(context)
.codeNo +
" : ",
fontWeight:
FontWeight
.w700,
fontSize:
13.0,
),
AppText(
model
.procedureList[
0]
.entityList[
index]
.procedureId
.toString(),
fontSize:
12.0,
),
SizedBox(
width: 12.0,
),
AppText(
TranslationBase.of(context)
.orderType +
" : ",
fontWeight:
FontWeight
.w700,
fontSize:
13.0,
),
Expanded(
child: AppText(
model.procedureList[0].entityList[index].orderType ==
0
? 'Routine'
: 'Urgent',
fontSize:
13.5,
color: model.procedureList[0].entityList[index].orderType ==
1
? Color(0xFFB9382C)
: Colors.green),
),
],
),
Row(
children: [
AppText(
'Order.NO' +
" : ",
fontWeight:
FontWeight
.w700,
fontSize:
15.0,
),
AppText(
model
.procedureList[
0]
.entityList[
index]
.orderNo
.toString(),
fontSize:
13.0,
),
],
),
Row(
children: [
Container(
child:
Expanded(
child:
AppText(
model
.procedureList[0]
.entityList[index]
.procedureName,
fontWeight:
FontWeight.w800,
),
),
)
],
),
Row(
children: [
// AppText(
// TranslationBase.of(context)
// .price +
// " : ",
// fontWeight:
// FontWeight
// .w700,
// ),
// Expanded(
// child: AppText(
// model
// .procedureList[
// 0]
// .entityList[
// index]
// .price
// .toString(),
// fontSize:
// 13.0),
// )
],
),
SizedBox(
height: 10.0,
),
Row(
children: [
Expanded(
child:
Container(
height: MediaQuery.of(context)
.size
.height *
0.047,
width: MediaQuery.of(context)
.size
.width *
0.10,
child:
AppText(
model.procedureList[0].entityList[index].remarks !=
null
? model.procedureList[0].entityList[index].remarks.toString()
: "",
fontSize:
11.5,
),
),
),
],
),
SizedBox(
height: 20.0,
),
// SizedBox(
// height: 40,
// ),
],
),
),
),
Container(
child: Column(
children: [
InkWell(
child: Icon(
Icons.edit),
onTap: () {
// model
// .updateProcedure();
if (model.procedureList[0].entityList[index].categoryID == 02 ||
model
.procedureList[
0]
.entityList[
index]
.categoryID ==
03 ||
model
.procedureList[0]
.entityList[index]
.categoryID ==
55) {
updateProcedureForm(
context,
limetNo: model
.procedureList[
0]
.entityList[
index]
.lineItemNo,
model:
model,
orderNo: model
.procedureList[
0]
.entityList[
index]
.orderNo,
remarks: model
.procedureList[
0]
.entityList[
index]
.remarks,
procedureName: model
.procedureList[
0]
.entityList[
index]
.procedureName,
patient:
patient,
procedureId: model
.procedureList[
0]
.entityList[
index]
.procedureId,
categoreId: model
.procedureList[
0]
.entityList[
index]
.categoryID
.toString());
} else {
helpers.showErrorToast(
'You cant Update this Procedure');
}
},
)
],
),
),
],
),
Divider(
height: 1.0,
thickness: 1.0,
color: Colors.grey,
),
],
),
),
),
],
),
),
)
: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
InkWell(
onTap: () {
model
.getProcedureCategory()
.then((value) {
addSelectedProcedure(
context, model, patient);
});
//model.postPrescription();
},
child: CircleAvatar(
radius: 65,
backgroundColor: Color(0XFFB8382C),
child: CircleAvatar(
radius: 60,
backgroundColor: Colors.white,
child: Icon(
Icons.add,
color: Colors.black,
size: 45.0,
),
),
),
),
SizedBox(
height: 15.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppText(
'NO ORDER FOR PROCEDURE LISTED',
color: Colors.black,
fontWeight: FontWeight.w900,
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppText(
TranslationBase.of(context).addNow,
color: Color(0XFFB8382C),
fontWeight: FontWeight.w700,
),
],
),
],
)
],
),
),
),
)),
);
}
}