Merge branch 'pharmacy_ntervention' of http://34.17.52.180/Haroon6138/doctor_app_flutter into update_3.16.0_CR5439_Pharmacy_Intervention
# Conflicts: # lib/config/localized_values.dart # lib/utils/translations_delegate_base_utils.dartupdate_3.16.0_CR5439_Pharmacy_Intervention
commit
26a60cc26f
@ -0,0 +1,300 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/patients/ReferralDischargedPatientPage.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/patients/profile/referral/refer_details/referred-patient-screen.dart';
|
||||||
|
import 'package:doctor_app_flutter/utils/tab_utils.dart';
|
||||||
|
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.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:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
import '../../config/config.dart';
|
||||||
|
|
||||||
|
class PharmacyIntervention extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_PharmacyIntervention createState() => _PharmacyIntervention();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PharmacyIntervention extends State<PharmacyIntervention>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
TabController? _tabController;
|
||||||
|
int index = 0;
|
||||||
|
List<dynamic> listOfPharmacyIntervention = List.empty();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_tabController = TabController(length: 3, vsync: this);
|
||||||
|
_tabController!.addListener(_handleTabSelection);
|
||||||
|
}
|
||||||
|
|
||||||
|
_handleTabSelection() {
|
||||||
|
setState(() {
|
||||||
|
index = _tabController!.index;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
_tabController!.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
ProjectViewModel projectsProvider = Provider.of<ProjectViewModel>(context);
|
||||||
|
|
||||||
|
return AppScaffold(
|
||||||
|
isShowAppBar: true,
|
||||||
|
appBar: PatientSearchHeader(
|
||||||
|
title: TranslationBase.of(context).pharmacyApproval,
|
||||||
|
fontSize: 18,
|
||||||
|
showSearchIcon: true,
|
||||||
|
onSearchPressed: () {
|
||||||
|
SearchDialog();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
appBarTitle: TranslationBase.of(context).pharmacyApproval,
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 56,
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
decoration: TabUtils.getBoxTabsBoxDecoration(
|
||||||
|
isActive: index == 0,
|
||||||
|
isFirst: true,
|
||||||
|
projectViewModel: projectsProvider),
|
||||||
|
child: Center(
|
||||||
|
child: TabUtils.getTabText(
|
||||||
|
title: TranslationBase.of(context).pending,
|
||||||
|
isActive: index == 0)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
decoration: TabUtils.getBoxTabsBoxDecoration(
|
||||||
|
isActive: index == 1,
|
||||||
|
isMiddle: true,
|
||||||
|
projectViewModel: projectsProvider),
|
||||||
|
child: Center(
|
||||||
|
child: TabUtils.getTabText(
|
||||||
|
title: TranslationBase.of(context).accepted,
|
||||||
|
isActive: index == 1)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
decoration: TabUtils.getBoxTabsBoxDecoration(
|
||||||
|
isActive: index == 2,
|
||||||
|
isLast: true,
|
||||||
|
projectViewModel: projectsProvider),
|
||||||
|
child: Center(
|
||||||
|
child: TabUtils.getTabText(
|
||||||
|
title: TranslationBase.of(context).rejected,
|
||||||
|
isActive: index == 2),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: listOfPharmacyIntervention.length,
|
||||||
|
itemBuilder: (context, item) => SizedBox.shrink()),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SearchDialog() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: true, // user must tap button!
|
||||||
|
builder: (_) {
|
||||||
|
return PharmacyInterventionDialog(
|
||||||
|
onDispose: (dateFrom, dateTo, admissionNumber, patientId) {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PharmacyInterventionDialog extends StatefulWidget {
|
||||||
|
final Function(
|
||||||
|
String,
|
||||||
|
String,
|
||||||
|
String,
|
||||||
|
String,
|
||||||
|
) onDispose;
|
||||||
|
|
||||||
|
const PharmacyInterventionDialog({super.key, required this.onDispose});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<PharmacyInterventionDialog> createState() =>
|
||||||
|
_PharmacyInterventionDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PharmacyInterventionDialogState
|
||||||
|
extends State<PharmacyInterventionDialog> {
|
||||||
|
final TextEditingController admissionNumber = TextEditingController();
|
||||||
|
final TextEditingController nursingStation = TextEditingController();
|
||||||
|
|
||||||
|
final TextEditingController patientId = TextEditingController();
|
||||||
|
|
||||||
|
String dateFrom = '';
|
||||||
|
|
||||||
|
String dateTo = '';
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
initFromDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Dialog(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(24),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
_titleAndTextField(TranslationBase.of(context).nursingStation,
|
||||||
|
nursingStation, TextInputType.number),
|
||||||
|
SizedBox(
|
||||||
|
height: 4,
|
||||||
|
),
|
||||||
|
_titleAndTextField(TranslationBase.of(context).admissionNumber,
|
||||||
|
admissionNumber, TextInputType.number),
|
||||||
|
SizedBox(
|
||||||
|
height: 4,
|
||||||
|
),
|
||||||
|
_titleAndTextField(TranslationBase.of(context).patientID, patientId,
|
||||||
|
TextInputType.number),
|
||||||
|
SizedBox(
|
||||||
|
height: 4,
|
||||||
|
),
|
||||||
|
_dateSelection(TranslationBase.of(context).dateFrom, (date) {
|
||||||
|
setState(() {
|
||||||
|
dateFrom = date;
|
||||||
|
});
|
||||||
|
}, dateFrom),
|
||||||
|
SizedBox(
|
||||||
|
height: 4,
|
||||||
|
),
|
||||||
|
_dateSelection(TranslationBase.of(context).dateTo, (date) {
|
||||||
|
setState(() {
|
||||||
|
dateTo = date;
|
||||||
|
});
|
||||||
|
}, dateTo),
|
||||||
|
SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
Row(children: [
|
||||||
|
Expanded(
|
||||||
|
child: AppButton(
|
||||||
|
title: TranslationBase.of(context).search,
|
||||||
|
hasBorder: true,
|
||||||
|
borderColor: Color(0xFFB8382B),
|
||||||
|
color: AppGlobal.appRedColor,
|
||||||
|
fontColor: Colors.white,
|
||||||
|
onPressed: () async {},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _dateSelection(
|
||||||
|
String title, Function(String) onDateSelected, String selectedDate) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () => _selectDate(onDateSelected),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text(title),
|
||||||
|
Expanded(
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(
|
||||||
|
selectedDate,
|
||||||
|
),
|
||||||
|
trailing: Icon(Icons.arrow_drop_down_outlined),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future _selectDate(Function(String) updateDate) async {
|
||||||
|
final DateTime? picked = await showDatePicker(
|
||||||
|
context: context,
|
||||||
|
initialDate: DateTime.now(),
|
||||||
|
firstDate: DateTime(DateTime.now().year - 150),
|
||||||
|
lastDate: DateTime(DateTime.now().year + 150),
|
||||||
|
initialEntryMode: DatePickerEntryMode.calendar,
|
||||||
|
builder: (_, child) {
|
||||||
|
return Theme(
|
||||||
|
data: ThemeData.light().copyWith(
|
||||||
|
colorScheme: ColorScheme.fromSwatch(
|
||||||
|
primarySwatch: Colors.red,
|
||||||
|
accentColor: AppGlobal.appRedColor,
|
||||||
|
),
|
||||||
|
dialogBackgroundColor: Colors.white,
|
||||||
|
),
|
||||||
|
child: child!,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
if (picked != null) {
|
||||||
|
updateDate(getFormattedDate(picked));
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _titleAndTextField(String title, TextEditingController controller,
|
||||||
|
TextInputType? inputType) {
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text(title),
|
||||||
|
Expanded(
|
||||||
|
child: TextFormField(
|
||||||
|
keyboardType: inputType,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: '',
|
||||||
|
focusedBorder: InputBorder.none,
|
||||||
|
enabledBorder: InputBorder.none,
|
||||||
|
contentPadding: EdgeInsetsDirectional.only(start: 10.0),
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
controller: controller,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void initFromDate() {
|
||||||
|
var time = DateTime.now();
|
||||||
|
dateFrom = getFormattedDate(time);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getFormattedDate(DateTime time) {
|
||||||
|
return DateFormat('MM/dd/yyyy').format(time);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue