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.
209 lines
9.2 KiB
Dart
209 lines
9.2 KiB
Dart
import 'package:doctor_app_flutter/config/config.dart';
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.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/date-utils.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_buttons_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:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
class AdmissionRequestThirdScreen extends StatefulWidget {
|
|
@override
|
|
_AdmissionRequestThirdScreenState createState() => _AdmissionRequestThirdScreenState();
|
|
}
|
|
|
|
class _AdmissionRequestThirdScreenState extends State<AdmissionRequestThirdScreen> {
|
|
|
|
final _postPlansEstimatedCostController = TextEditingController();
|
|
final _dietTypeRemarksController = TextEditingController();
|
|
DateTime _dischargeDate;
|
|
dynamic _selectedDietType;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
PatiantInformtion patient = routeArgs['patient'];
|
|
final screenSize = MediaQuery.of(context).size;
|
|
|
|
return BaseView<AdmissionRequestViewModel>(
|
|
// onModelReady: (model) => model.getMasterLookup(),
|
|
builder: (_, model, w) => AppScaffold(
|
|
baseViewModel: model,
|
|
appBarTitle: TranslationBase.of(context).admissionRequest,
|
|
body: model.doctorsList != null
|
|
? Column(
|
|
children: [
|
|
Expanded(
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
PatientPageHeaderWidget(patient),
|
|
Container(
|
|
margin: EdgeInsets.symmetric(
|
|
vertical: 16, horizontal: 16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
SizedBox(
|
|
height: 16,
|
|
),
|
|
AppText(
|
|
TranslationBase.of(context).postPlansEstimatedCost,
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.textMultiplier * 2.5,
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Container(
|
|
child: TextField(
|
|
decoration:
|
|
Helpers.textFieldSelectorDecoration(
|
|
TranslationBase.of(context)
|
|
.postPlansEstimatedCost,
|
|
null,
|
|
false),
|
|
enabled: true,
|
|
controller: _postPlansEstimatedCostController,
|
|
keyboardType: TextInputType.text,
|
|
minLines: 4,
|
|
maxLines: 6,
|
|
)),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Container(
|
|
height: screenSize.height * 0.070,
|
|
child: InkWell(
|
|
onTap: () {
|
|
if (_dischargeDate == null) {
|
|
_dischargeDate = DateTime.now();
|
|
}
|
|
_selectDate(
|
|
context, _dischargeDate,
|
|
(picked) {
|
|
setState(() {
|
|
_dischargeDate = picked;
|
|
});
|
|
});
|
|
},
|
|
child: TextField(
|
|
decoration:
|
|
Helpers.textFieldSelectorDecoration(
|
|
TranslationBase.of(context)
|
|
.expectedAdmissionDate,
|
|
_dischargeDate != null
|
|
? "${DateUtils.convertStringToDateFormat(_dischargeDate.toString(), "yyyy-MM-dd")}"
|
|
: null,
|
|
true,
|
|
suffixIcon: Icon(
|
|
Icons.calendar_today,
|
|
color: Colors.black,
|
|
)),
|
|
enabled: false,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Container(
|
|
height: screenSize.height * 0.070,
|
|
child: InkWell(
|
|
onTap: /*model.doctorsList != null &&
|
|
model.doctorsList.length > 0
|
|
? () {
|
|
ListSelectDialog dialog =
|
|
ListSelectDialog(
|
|
list: model.doctorsList,
|
|
attributeName: 'DoctorName',
|
|
attributeValueId: 'DoctorID',
|
|
okText: TranslationBase.of(context).ok,
|
|
okFunction: (selectedValue) {
|
|
setState(() {
|
|
_selectedDoctor = selectedValue;
|
|
});
|
|
},
|
|
);
|
|
showDialog(
|
|
barrierDismissible: false,
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return dialog;
|
|
},
|
|
);
|
|
}
|
|
:*/ null,
|
|
child: TextField(
|
|
decoration: Helpers.textFieldSelectorDecoration(
|
|
TranslationBase.of(context).dietType,
|
|
/* _admissionType != null
|
|
? _admissionType['DoctorName']
|
|
:*/ null,
|
|
true),
|
|
enabled: false,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Container(
|
|
child: TextField(
|
|
decoration:
|
|
Helpers.textFieldSelectorDecoration(
|
|
TranslationBase.of(context)
|
|
.dietTypeRemarks,
|
|
null,
|
|
false),
|
|
enabled: true,
|
|
controller: _dietTypeRemarksController,
|
|
keyboardType: TextInputType.text,
|
|
minLines: 4,
|
|
maxLines: 6,
|
|
)),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
child: AppButton(
|
|
title: TranslationBase.of(context).save,
|
|
color: HexColor("#B8382B"),
|
|
onPressed: null,
|
|
),
|
|
),
|
|
],
|
|
)
|
|
: Container(),
|
|
),
|
|
);
|
|
}
|
|
|
|
Future _selectDate(BuildContext context, DateTime dateTime,
|
|
Function(DateTime picked) updateDate) async {
|
|
final DateTime picked = await showDatePicker(
|
|
context: context,
|
|
initialDate: dateTime,
|
|
firstDate: DateTime.now(),
|
|
lastDate: DateTime(2040),
|
|
initialEntryMode: DatePickerEntryMode.calendar,
|
|
);
|
|
if (picked != null && picked != dateTime) {
|
|
updateDate(picked);
|
|
}
|
|
}
|
|
}
|