|
|
|
|
@ -1,23 +1,28 @@
|
|
|
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/nursing_station.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
|
|
|
|
|
import '../../../widgets/shared/app_texts_widget.dart';
|
|
|
|
|
import '../../patients/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart';
|
|
|
|
|
|
|
|
|
|
class PharmacyInterventionDialog extends StatefulWidget {
|
|
|
|
|
final Function(
|
|
|
|
|
String, // dataFrom
|
|
|
|
|
String, // dateTo
|
|
|
|
|
String, // admissionNumber
|
|
|
|
|
String, // patient ID
|
|
|
|
|
String, // nursingStation
|
|
|
|
|
NursingStationEntity?, // nursingStation
|
|
|
|
|
) onDispose;
|
|
|
|
|
|
|
|
|
|
final String dateFrom;
|
|
|
|
|
final String dateTo;
|
|
|
|
|
final String admissionNumber;
|
|
|
|
|
final String patientID;
|
|
|
|
|
final String nursingStation;
|
|
|
|
|
final NursingStationEntity? nursingStation;
|
|
|
|
|
final NursingStation? station;
|
|
|
|
|
|
|
|
|
|
const PharmacyInterventionDialog({super.key,
|
|
|
|
|
required this.onDispose,
|
|
|
|
|
@ -25,7 +30,9 @@ class PharmacyInterventionDialog extends StatefulWidget {
|
|
|
|
|
required this.dateTo,
|
|
|
|
|
required this.admissionNumber,
|
|
|
|
|
required this.patientID,
|
|
|
|
|
required this.nursingStation});
|
|
|
|
|
required this.nursingStation,
|
|
|
|
|
required this.station,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<PharmacyInterventionDialog> createState() =>
|
|
|
|
|
@ -35,7 +42,7 @@ class PharmacyInterventionDialog extends StatefulWidget {
|
|
|
|
|
class _PharmacyInterventionDialogState
|
|
|
|
|
extends State<PharmacyInterventionDialog> {
|
|
|
|
|
final TextEditingController admissionNumber = TextEditingController();
|
|
|
|
|
final TextEditingController nursingStation = TextEditingController();
|
|
|
|
|
NursingStationEntity? nursingStation = null;
|
|
|
|
|
|
|
|
|
|
final TextEditingController patientId = TextEditingController();
|
|
|
|
|
|
|
|
|
|
@ -51,7 +58,7 @@ class _PharmacyInterventionDialogState
|
|
|
|
|
|
|
|
|
|
void initData() {
|
|
|
|
|
admissionNumber.text = (widget.admissionNumber == '0')?'':widget.admissionNumber;
|
|
|
|
|
nursingStation.text = (widget.nursingStation == '0')?'':widget.nursingStation;
|
|
|
|
|
nursingStation = widget.nursingStation;
|
|
|
|
|
patientId.text = (widget.patientID == '0' )?'':widget.patientID;
|
|
|
|
|
dateTo = getDateString(widget.dateTo);
|
|
|
|
|
dateFrom = getDateString(widget.dateFrom);
|
|
|
|
|
@ -66,93 +73,92 @@ class _PharmacyInterventionDialogState
|
|
|
|
|
),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(24),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(Icons.close),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 8,),
|
|
|
|
|
_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) {
|
|
|
|
|
DateTime? fromDate = getDate(date);
|
|
|
|
|
DateTime? toDate =getDate(dateTo);
|
|
|
|
|
if(toDate == null){
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(Icons.close),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 8,),
|
|
|
|
|
nursingStationView,
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
_titleAndTextField(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.admissionNumber,
|
|
|
|
|
admissionNumber, TextInputType.text),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
_titleAndTextField(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.patientID, patientId,
|
|
|
|
|
TextInputType.number),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
_dateSelection(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.dateFrom, (date) {
|
|
|
|
|
DateTime? fromDate = getDate(date);
|
|
|
|
|
DateTime? toDate = getDate(dateTo);
|
|
|
|
|
if (toDate == null) {
|
|
|
|
|
setState(() {
|
|
|
|
|
dateFrom = date;
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (fromDate!.compareTo(toDate!) == 1) {
|
|
|
|
|
setState(() {
|
|
|
|
|
dateFrom = date;
|
|
|
|
|
dateTo = '';
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
setState(() {
|
|
|
|
|
dateFrom = date;
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(fromDate!.compareTo(toDate!) == 1){
|
|
|
|
|
}, dateFrom, false),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
_dateSelection(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.dateTo, (date) {
|
|
|
|
|
setState(() {
|
|
|
|
|
dateFrom = date;
|
|
|
|
|
dateTo = '';
|
|
|
|
|
dateTo = date;
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
setState(() {
|
|
|
|
|
dateFrom = date;
|
|
|
|
|
});
|
|
|
|
|
}, dateFrom, false),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
_dateSelection(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.dateTo, (date) {
|
|
|
|
|
setState(() {
|
|
|
|
|
dateTo = date;
|
|
|
|
|
});
|
|
|
|
|
}, dateTo, true, selectedFromDate: dateFrom),
|
|
|
|
|
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 {
|
|
|
|
|
//(dateFrom, dateTo, admissionNumber, patientId, nursingStation)
|
|
|
|
|
widget.onDispose(dateFrom, dateTo, nursingStation.text,
|
|
|
|
|
patientId.text, nursingStation.text);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
}, dateTo, true, selectedFromDate: dateFrom),
|
|
|
|
|
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 {
|
|
|
|
|
//(dateFrom, dateTo, admissionNumber, patientId, nursingStation)
|
|
|
|
|
widget.onDispose(dateFrom, dateTo, admissionNumber.text,
|
|
|
|
|
patientId.text, nursingStation);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
@ -184,8 +190,11 @@ class _PharmacyInterventionDialogState
|
|
|
|
|
DateTime? fromDate = getDate(selectedFromDate??'');
|
|
|
|
|
final DateTime? picked = await showDatePicker(
|
|
|
|
|
context: context,
|
|
|
|
|
initialDate:date.isNotEmpty? getDate(date) :fromDate != null? fromDate: DateTime.now(),
|
|
|
|
|
firstDate:(( date.isNotEmpty && dateTime != null ) ) ? dateTime: (toDateSelection && fromDate != null)?fromDate :DateTime(DateTime
|
|
|
|
|
initialDate: date.isNotEmpty ? getDate(date) : fromDate != null
|
|
|
|
|
? fromDate
|
|
|
|
|
: DateTime.now(),
|
|
|
|
|
firstDate: (toDateSelection && fromDate != null) ? fromDate : ((date
|
|
|
|
|
.isNotEmpty && dateTime != null)) ? dateTime : DateTime(DateTime
|
|
|
|
|
.now()
|
|
|
|
|
.year - 150),
|
|
|
|
|
lastDate: DateTime(DateTime
|
|
|
|
|
@ -257,4 +266,50 @@ class _PharmacyInterventionDialogState
|
|
|
|
|
int.parse(splitedDate[1]), int.parse(splitedDate[2]));
|
|
|
|
|
return now;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget get nursingStationView =>
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.nursingStation,),
|
|
|
|
|
SizedBox(width: 10,),
|
|
|
|
|
widget.station?.entityList?.isEmpty == true ? Expanded(
|
|
|
|
|
child: EmptyDropDown())
|
|
|
|
|
: Expanded(
|
|
|
|
|
child: DropdownButtonHideUnderline(
|
|
|
|
|
child: DropdownButton(
|
|
|
|
|
dropdownColor: Colors.white,
|
|
|
|
|
iconEnabledColor: Colors.black,
|
|
|
|
|
icon: Icon(Icons.keyboard_arrow_down),
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
value: nursingStation == null
|
|
|
|
|
? widget.station?.entityList?.first
|
|
|
|
|
: nursingStation,
|
|
|
|
|
iconSize: 25,
|
|
|
|
|
elevation: 16,
|
|
|
|
|
onChanged: (newValue) async {
|
|
|
|
|
if (newValue != null)
|
|
|
|
|
setState(() {
|
|
|
|
|
nursingStation = newValue ;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
items:
|
|
|
|
|
widget.station?.entityList?.map((item) {
|
|
|
|
|
return DropdownMenuItem(
|
|
|
|
|
child: AppText(
|
|
|
|
|
item.description ?? '',
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
letterSpacing: -0.96,
|
|
|
|
|
color: AppGlobal.appTextColor,
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
|
),
|
|
|
|
|
value: item,
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
]);
|
|
|
|
|
}
|