finish sick leave design

merge-requests/847/head
Elham Rababh 5 years ago
parent ff07686bf7
commit f05455fddf

@ -27,12 +27,9 @@ class SickLeaveService extends BaseService {
dynamic get postReschedule => _postReschedule; dynamic get postReschedule => _postReschedule;
dynamic _postReschedule; dynamic _postReschedule;
dynamic get sickLeaveResponse => _sickLeaveResponse;
dynamic _sickLeaveResponse;
List<SickLeavePatientModel> getAllSickLeavePatient = List(); List<SickLeavePatientModel> getAllSickLeavePatient = List();
List<SickLeavePatientModel> getAllSickLeaveDoctor = List(); List<SickLeavePatientModel> getAllSickLeaveDoctor = List();
//getAllSickLeavePatient.addAll(getAllSickLeaveDoctor);
SickLeavePatientRequestModel _sickLeavePatientRequestModel = SickLeavePatientRequestModel(); SickLeavePatientRequestModel _sickLeavePatientRequestModel = SickLeavePatientRequestModel();
GetSickLeaveDoctorRequestModel _sickLeaveDoctorRequestModel = GetSickLeaveDoctorRequestModel(); GetSickLeaveDoctorRequestModel _sickLeaveDoctorRequestModel = GetSickLeaveDoctorRequestModel();
@ -56,8 +53,6 @@ class SickLeaveService extends BaseService {
Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async {
hasError = false; hasError = false;
if(_sickLeaveResponse!= null)
_sickLeaveResponse.clear();
await baseAppClient.post( await baseAppClient.post(
ADD_SICK_LEAVE, ADD_SICK_LEAVE,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
@ -80,7 +75,6 @@ class SickLeaveService extends BaseService {
await baseAppClient.post( await baseAppClient.post(
EXTEND_SICK_LEAVE, EXTEND_SICK_LEAVE,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_sickLeaveResponse = response;
return Future.value(response); return Future.value(response);
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {

@ -10,8 +10,7 @@ class SickLeaveViewModel extends BaseViewModel {
SickLeaveService _sickLeaveService = locator<SickLeaveService>(); SickLeaveService _sickLeaveService = locator<SickLeaveService>();
get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics; get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics;
get getAllSIckLeave => _sickLeaveService.getAllSickLeave; get getAllSIckLeave => _sickLeaveService.getAllSickLeave;
//get getAllSIckLeavePatient => _sickLeaveService.getAllSickLeavePatient;
get sickleaveResponse => _sickLeaveService.sickLeaveResponse;
List get allOffTime => _sickLeaveService.getOffTimeList; List get allOffTime => _sickLeaveService.getOffTimeList;
List get allReasons => _sickLeaveService.getReasons; List get allReasons => _sickLeaveService.getReasons;
@ -32,11 +31,11 @@ class SickLeaveViewModel extends BaseViewModel {
} }
Future extendSickLeave(GetAllSickLeaveResponse extendSickLeaveRequest) async { Future extendSickLeave(GetAllSickLeaveResponse extendSickLeaveRequest) async {
setState(ViewState.Busy); setState(ViewState.BusyLocal);
await _sickLeaveService.extendSickLeave(extendSickLeaveRequest); await _sickLeaveService.extendSickLeave(extendSickLeaveRequest);
if (_sickLeaveService.hasError) { if (_sickLeaveService.hasError) {
error = _sickLeaveService.error; error = _sickLeaveService.error;
setState(ViewState.Error); setState(ViewState.ErrorLocal);
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }

@ -46,7 +46,7 @@ class _AddMedicationState extends State<AddMedication> {
GetMedicationResponseModel _selectedMedication; GetMedicationResponseModel _selectedMedication;
GlobalKey key = GlobalKey key =
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>(); new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
bool isFormSubmitted = false; bool isFormSubmitted = false;
@override @override
@ -54,424 +54,395 @@ class _AddMedicationState extends State<AddMedication> {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return FractionallySizedBox( return FractionallySizedBox(
child: BaseView<SOAPViewModel>( child: BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
model.onAddMedicationStart(); model.onAddMedicationStart();
}, },
builder: (_, model, w) => builder: (_, model, w) => AppScaffold(
AppScaffold( baseViewModel: model,
baseViewModel: model, isShowAppBar: true,
isShowAppBar: true, appBar: BottomSheetTitle(
appBar: BottomSheetTitle( title: TranslationBase.of(context).addMedication,
title: TranslationBase ),
.of(context) body: Center(
.addMedication, child: Container(
), child: Column(
body: Center( crossAxisAlignment: CrossAxisAlignment.start,
child: Container( children: [
child: Column( SizedBox(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 10, height: 10,
), ),
Expanded( Expanded(
child: FractionallySizedBox( child: FractionallySizedBox(
widthFactor: 0.9, widthFactor: 0.9,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
SizedBox( SizedBox(
height: SizeConfig.heightMultiplier * ( height: SizeConfig.heightMultiplier *
SizeConfig.isHeightVeryShort ?2:SizeConfig.isHeightShort? (SizeConfig.isHeightVeryShort
2:2), ? 2
), : SizeConfig.isHeightShort
Container( ? 2
// height: screenSize.height * 0.070, : 2),
child: InkWell( ),
onTap: model.allMedicationList != null Container(
? () { // height: screenSize.height * 0.070,
setState(() { child: InkWell(
_selectedMedication = null; onTap: model.allMedicationList != null
}); ? () {
} setState(() {
: null, _selectedMedication = null;
child: _selectedMedication == null });
? CustomAutoCompleteTextField( }
isShowError: isFormSubmitted && : null,
_selectedMedication == null, child: _selectedMedication == null
child: AutoCompleteTextField< ? CustomAutoCompleteTextField(
GetMedicationResponseModel>( isShowError: isFormSubmitted &&
decoration: TextFieldsUtils _selectedMedication == null,
.textFieldSelectorDecoration( child: AutoCompleteTextField<
TranslationBase GetMedicationResponseModel>(
.of( decoration: TextFieldsUtils
context) .textFieldSelectorDecoration(
.searchMedicineNameHere, TranslationBase.of(
null, context)
true, .searchMedicineNameHere,
suffixIcon: null,
Icons.search), true,
itemSubmitted: (item) => suffixIcon:
setState(() => Icons.search),
_selectedMedication = itemSubmitted: (item) =>
item), setState(() =>
key: key, _selectedMedication =
suggestions: item),
model.allMedicationList, key: key,
itemBuilder: (context, suggestions:
suggestion) => model.allMedicationList,
new Padding( itemBuilder: (context,
child: AppText(suggestion suggestion) =>
.description + new Padding(
'/' + child: AppText(suggestion
suggestion .description +
.genericName), '/' +
padding: suggestion
EdgeInsets.all( .genericName),
8.0)), padding: EdgeInsets.all(
itemSorter: (a, b) => 1, 8.0)),
itemFilter: (suggestion, itemSorter: (a, b) => 1,
input) => itemFilter: (suggestion,
suggestion.genericName.toLowerCase() input) =>
.startsWith(input.toLowerCase()) || suggestion.genericName.toLowerCase().startsWith(
suggestion.description input.toLowerCase()) ||
.toLowerCase() suggestion.description
.startsWith(input .toLowerCase()
.toLowerCase()) || .startsWith(input
suggestion.keywords .toLowerCase()) ||
.toLowerCase() suggestion.keywords
.startsWith(input .toLowerCase()
.toLowerCase()), .startsWith(input
), .toLowerCase()),
) ),
: AppTextFieldCustom( )
height: Helpers.getTextFieldHeight(), : AppTextFieldCustom(
hintText: _selectedMedication != height:
null Helpers.getTextFieldHeight(),
? _selectedMedication hintText: _selectedMedication !=
.description + null
(' (${_selectedMedication.genericName} )') ? _selectedMedication
: TranslationBase .description +
.of( (' (${_selectedMedication.genericName} )')
context) : TranslationBase.of(context)
.searchMedicineNameHere, .searchMedicineNameHere,
minLines: 1, minLines: 1,
maxLines: 1, maxLines: 1,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon( icon: Icon(
Icons.search, Icons.search,
color: Colors.grey.shade600, color: Colors.grey.shade600,
)), )),
enabled: false, enabled: false,
), ),
), ),
), ),
if (_selectedMedication != null)
if(_selectedMedication != null) Column(
Column( children: [
children: [ SizedBox(
SizedBox( height: 3,
height: 3, ),
), Container(
Container( width: MediaQuery.of(context)
width: MediaQuery .size
.of(context) .width *
.size 0.7,
.width * 0.7, child: AppText(
child: AppText( _selectedMedication.description +
_selectedMedication.description + (' (${_selectedMedication.genericName} )'),
(' (${_selectedMedication.genericName} )'), color: Color(0xFF575757),
color: Color(0xFF575757), fontSize: 10,
fontSize: 10, fontWeight: FontWeight.w700,
fontWeight: FontWeight.w700, letterSpacing: -0.4,
letterSpacing: -0.4, ),
), ),
), ],
], ),
), SizedBox(
SizedBox( height: 5,
height: 5, ),
), AppTextFieldCustom(
AppTextFieldCustom( height: Helpers.getTextFieldHeight(),
height: Helpers.getTextFieldHeight(), enabled: false,
enabled: false, onClick: model.medicationDoseTimeList !=
onClick: model.medicationDoseTimeList != null
null ? () {
? () { MasterKeyDailog dialog =
MasterKeyDailog dialog = MasterKeyDailog(
MasterKeyDailog( list:
list: model model.medicationDoseTimeList,
.medicationDoseTimeList, okText:
okText: TranslationBase.of(context)
TranslationBase .ok,
.of(context) selectedValue:
.ok, _selectedMedicationDose,
selectedValue: okFunction: (selectedValue) {
_selectedMedicationDose, setState(() {
okFunction: (selectedValue) { _selectedMedicationDose =
setState(() { selectedValue;
_selectedMedicationDose =
selectedValue;
doseController
.text = projectViewModel
.isArabic
? _selectedMedicationDose
.nameAr
: _selectedMedicationDose
.nameEn;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
hintText:
TranslationBase
.of(context)
.doseTime,
maxLines: 1,
minLines: 1,
isTextFieldHasSuffix: true,
controller: doseController,
validationError: isFormSubmitted &&
_selectedMedicationDose == null
? TranslationBase
.of(context)
.emptyMessage
: null,
),
SizedBox(
height: 5,
),
AppTextFieldCustom(
height: Helpers.getTextFieldHeight(),
enabled: false,
isTextFieldHasSuffix: true,
onClick: model.medicationStrengthList !=
null
? () {
MasterKeyDailog dialog =
MasterKeyDailog(
list: model
.medicationStrengthList,
okText:
TranslationBase
.of(context)
.ok,
selectedValue:
_selectedMedicationStrength,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationStrength =
selectedValue;
strengthController doseController
.text = projectViewModel .text = projectViewModel
.isArabic .isArabic
? _selectedMedicationStrength ? _selectedMedicationDose
.nameAr .nameAr
: _selectedMedicationStrength : _selectedMedicationDose
.nameEn; .nameEn;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: builder: (BuildContext context) {
(BuildContext context) { return dialog;
return dialog; },
}, );
); }
} : null,
: null, hintText:
hintText: TranslationBase.of(context).doseTime,
TranslationBase maxLines: 1,
.of(context) minLines: 1,
.strength, isTextFieldHasSuffix: true,
maxLines: 1, controller: doseController,
minLines: 1, validationError: isFormSubmitted &&
controller: strengthController, _selectedMedicationDose == null
validationError: isFormSubmitted && ? TranslationBase.of(context)
_selectedMedicationStrength == .emptyMessage
null : null,
? TranslationBase ),
.of(context) SizedBox(
.emptyMessage height: 5,
: null, ),
), AppTextFieldCustom(
SizedBox( height: Helpers.getTextFieldHeight(),
height: 5, enabled: false,
), isTextFieldHasSuffix: true,
SizedBox( onClick: model.medicationStrengthList !=
height: 5, null
), ? () {
AppTextFieldCustom( MasterKeyDailog dialog =
height: Helpers.getTextFieldHeight(), MasterKeyDailog(
enabled: false, list:
isTextFieldHasSuffix: true, model.medicationStrengthList,
onClick: model.medicationRouteList != null okText:
? () { TranslationBase.of(context)
MasterKeyDailog dialog = .ok,
MasterKeyDailog( selectedValue:
list: model.medicationRouteList, _selectedMedicationStrength,
selectedValue: okFunction: (selectedValue) {
_selectedMedicationRoute, setState(() {
okText: _selectedMedicationStrength =
TranslationBase selectedValue;
.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationRoute =
selectedValue;
routeController strengthController
.text = projectViewModel .text = projectViewModel
.isArabic .isArabic
? _selectedMedicationRoute ? _selectedMedicationStrength
.nameAr .nameAr
: _selectedMedicationRoute : _selectedMedicationStrength
.nameEn; .nameEn;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: builder: (BuildContext context) {
(BuildContext context) { return dialog;
return dialog; },
}, );
); }
} : null,
: null, hintText:
hintText: TranslationBase.of(context).strength,
TranslationBase maxLines: 1,
.of(context) minLines: 1,
.route, controller: strengthController,
maxLines: 1, validationError: isFormSubmitted &&
minLines: 1, _selectedMedicationStrength == null
controller: routeController, ? TranslationBase.of(context)
validationError: isFormSubmitted && .emptyMessage
_selectedMedicationRoute == null : null,
? TranslationBase ),
.of(context) SizedBox(
.emptyMessage height: 5,
: null, ),
), SizedBox(
SizedBox( height: 5,
height: 5, ),
), AppTextFieldCustom(
SizedBox( height: Helpers.getTextFieldHeight(),
height: 5, enabled: false,
), isTextFieldHasSuffix: true,
AppTextFieldCustom( onClick: model.medicationRouteList != null
height: Helpers.getTextFieldHeight(), ? () {
onClick: model.medicationFrequencyList != MasterKeyDailog dialog =
null MasterKeyDailog(
? () { list: model.medicationRouteList,
MasterKeyDailog dialog = selectedValue:
MasterKeyDailog( _selectedMedicationRoute,
list: model okText:
.medicationFrequencyList, TranslationBase.of(context)
okText: .ok,
TranslationBase okFunction: (selectedValue) {
.of(context) setState(() {
.ok, _selectedMedicationRoute =
selectedValue: selectedValue;
_selectedMedicationFrequency,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationFrequency =
selectedValue;
frequencyController routeController
.text = projectViewModel .text = projectViewModel
.isArabic .isArabic
? _selectedMedicationFrequency ? _selectedMedicationRoute
.nameAr .nameAr
: _selectedMedicationFrequency : _selectedMedicationRoute
.nameEn; .nameEn;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: builder: (BuildContext context) {
(BuildContext context) { return dialog;
return dialog; },
}, );
); }
} : null,
: null, hintText: TranslationBase.of(context).route,
hintText: maxLines: 1,
TranslationBase minLines: 1,
.of(context) controller: routeController,
.frequency, validationError: isFormSubmitted &&
enabled: false, _selectedMedicationRoute == null
maxLines: 1, ? TranslationBase.of(context)
minLines: 1, .emptyMessage
isTextFieldHasSuffix: true, : null,
controller: frequencyController, ),
validationError: isFormSubmitted && SizedBox(
_selectedMedicationFrequency == height: 5,
null ),
? TranslationBase SizedBox(
.of(context) height: 5,
.emptyMessage ),
: null, AppTextFieldCustom(
), height: Helpers.getTextFieldHeight(),
SizedBox( onClick: model.medicationFrequencyList !=
height: SizeConfig.heightMultiplier * null
(SizeConfig.isHeightVeryShort ? 20 : SizeConfig ? () {
.isHeightShort ? 15 : 10), MasterKeyDailog dialog =
), MasterKeyDailog(
list:
model.medicationFrequencyList,
okText:
TranslationBase.of(context)
.ok,
selectedValue:
_selectedMedicationFrequency,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationFrequency =
selectedValue;
], frequencyController
.text = projectViewModel
.isArabic
? _selectedMedicationFrequency
.nameAr
: _selectedMedicationFrequency
.nameEn;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
hintText:
TranslationBase.of(context).frequency,
enabled: false,
maxLines: 1,
minLines: 1,
isTextFieldHasSuffix: true,
controller: frequencyController,
validationError: isFormSubmitted &&
_selectedMedicationFrequency == null
? TranslationBase.of(context)
.emptyMessage
: null,
),
SizedBox(
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort
? 20
: SizeConfig.isHeightShort
? 15
: 10),
),
],
),
)),
), ),
)), ]),
), ),
]), ),
), bottomSheet: model.state != ViewState.Idle
), ? Container(
bottomSheet: model.state != ViewState.Idle height: 0,
? Container( )
height: 0, : BottomSheetDialogButton(
) label: TranslationBase.of(context).addMedication,
: BottomSheetDialogButton( onTap: () {
label: setState(() {
TranslationBase.of(context).addMedication, isFormSubmitted = true;
onTap: () { });
setState(() { if (_selectedMedication != null &&
isFormSubmitted = true; _selectedMedicationDose != null &&
}); _selectedMedicationStrength != null &&
if (_selectedMedication != null && _selectedMedicationRoute != null &&
_selectedMedicationDose != null && _selectedMedicationFrequency != null) {
_selectedMedicationStrength != null && widget.medicationController.text = widget
_selectedMedicationRoute != null && .medicationController.text +
_selectedMedicationFrequency != null) { '${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n';
widget.medicationController.text = widget Navigator.of(context).pop();
.medicationController.text + }
'${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n'; },
Navigator.of(context).pop(); )),
} ),
},
)
)
,
)
,
); );
} }
} }

@ -279,11 +279,6 @@ class AddSickLeavScreen extends StatelessWidget {
openSickLeave(BuildContext context, isExtend, openSickLeave(BuildContext context, isExtend,
{GetAllSickLeaveResponse extendedData}) { {GetAllSickLeaveResponse extendedData}) {
// showModalBottomSheet(
// context: context,
// builder: (context) {
// return new Container(
// child:
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(

@ -48,14 +48,14 @@ class SickLeaveScreen extends StatefulWidget {
class _SickLeaveScreenState extends State<SickLeaveScreen> { class _SickLeaveScreenState extends State<SickLeaveScreen> {
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
TextEditingController _toDateController = new TextEditingController(); TextEditingController _toDateController = new TextEditingController();
TextEditingController _numberOfController = new TextEditingController(); TextEditingController _numberOfDayController = new TextEditingController();
TextEditingController _clinicController = new TextEditingController(); TextEditingController _clinicController = new TextEditingController();
TextEditingController _doctorController = new TextEditingController(); TextEditingController _doctorController = new TextEditingController();
TextEditingController _remarkController = new TextEditingController(); TextEditingController _remarkController = new TextEditingController();
String _selectedClinic;
Map profile = {}; Map profile = {};
AddSickLeaveRequest addSickLeave = AddSickLeaveRequest(); AddSickLeaveRequest addSickLeave = AddSickLeaveRequest();
bool isFormSubmitted = false;
void _presentDatePicker(id) { void _presentDatePicker(id) {
showDatePicker( showDatePicker(
@ -100,299 +100,266 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
FocusScope.of(context).requestFocus(new FocusNode()); FocusScope.of(context).requestFocus(new FocusNode());
}, },
child: AppScaffold( child: AppScaffold(
baseViewModel: model2, baseViewModel: model2,
appBarTitle: widget.isExtended == true appBarTitle: widget.isExtended == true
? TranslationBase.of(context).extendSickLeave ? TranslationBase.of(context).extendSickLeave
: TranslationBase.of(context).addSickLeave, : TranslationBase.of(context).addSickLeave,
isShowAppBar: true, isShowAppBar: true,
body: Center( body: Center(
child: Container( child: Container(
margin: EdgeInsets.only(top: 10), margin: EdgeInsets.only(top: 10),
child: FractionallySizedBox( child: FractionallySizedBox(
widthFactor: 0.9,
child: ListView(
children: [
SizedBox(
height: 30,
),
AppTextFieldCustom(
height: Helpers.getTextFieldHeight(),
hintText: widget.extendedData != null
? widget.extendedData.noOfDays.toString()
: TranslationBase.of(context).sickLeave +
' ' +
TranslationBase.of(context).days,
maxLines: 1,
minLines: 1,
dropDownColor: Colors.white,
isTextFieldHasSuffix: true,
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(ONLY_NUMBERS))
],
controller: _numberOfController,
onChanged: (value) {
addSickLeave.noOfDays = value;
if (widget.extendedData != null) {
widget.extendedData.noOfDays =
int.parse(value);
}
},
// validationError: isFormSubmitted &&
// _selectedMedicationFrequency ==
// null
// ? TranslationBase
// .of(context)
// .emptyMessage
// : null,
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
height: Helpers.getTextFieldHeight(),
onClick: () {
_presentDatePicker('_selectedToDate');
},
hintText: widget.extendedData != null
? widget.extendedData.startDate
: TranslationBase.of(context).sickLeaveDate,
enabled: false,
maxLines: 1,
minLines: 1,
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(Icons.calendar_today)),
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(ONLY_NUMBERS))
],
controller: _toDateController,
onChanged: (value) {
addSickLeave.startDate = value;
if (widget.extendedData != null) {
widget.extendedData.startDate = value;
}
},
),
SizedBox(
height: 5,
),
AppTextFieldCustom(
height: Helpers.getTextFieldHeight(),
hintText:
TranslationBase.of(context).clinicName,
enabled: false,
maxLines: 1,
minLines: 1,
dropDownColor: Colors.white,
isTextFieldHasSuffix: true,
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(ONLY_NUMBERS))
],
controller: _clinicController,
onChanged: (value) {},
),
SizedBox(
height: 10,
),
model2.sickLeaveStatistics[
'recommendedSickLeaveDays'] !=
null
? AppText(
model2.sickLeaveStatistics[
'recommendedSickLeaveDays'],
fontWeight: FontWeight.bold,
textAlign: TextAlign.start,
fontSize: 15,
)
: SizedBox(
height: 10,
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
height: Helpers.getTextFieldHeight(),
hintText:
TranslationBase.of(context).doctorName,
enabled: false,
maxLines: 1,
minLines: 1,
dropDownColor: Colors.white,
isTextFieldHasSuffix: true,
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(ONLY_NUMBERS))
],
controller: _doctorController,
onChanged: (value) {},
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
height: Helpers.getTextFieldHeight(),
hintText: widget.extendedData != null
? widget.extendedData.remarks
: TranslationBase.of(context).remarks,
maxLines: 30,
minLines: 5,
dropDownColor: Colors.white,
isTextFieldHasSuffix: true,
controller: _remarkController,
onChanged: (value) {
addSickLeave.remarks = value;
if (widget.extendedData != null) {
widget.extendedData.remarks = value;
}
},
),
],
),
),
),
),
bottomSheet: model2.state ==ViewState.Busy || model.state == ViewState.Busy?Container(height: 0,): Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 12 : 10),
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
),
FractionallySizedBox(
widthFactor: 0.9, widthFactor: 0.9,
child: AppButton( child: ListView(
title: widget.isExtended == true children: [
? TranslationBase.of(context).extend SizedBox(
: TranslationBase.of(context) height: 30,
.addSickLeaverequest, ),
color: Colors.green, AppTextFieldCustom(
onPressed: () async { height: Helpers.getTextFieldHeight(),
if (widget.isExtended) { hintText: widget.extendedData != null
await model2.extendSickLeave( ? widget.extendedData.noOfDays.toString()
widget.extendedData); : TranslationBase.of(context).sickLeave +
' ' +
DrAppToastMsg.showSuccesToast( TranslationBase.of(context).days,
model2.sickleaveResponse[ maxLines: 1,
'ListSickLeavesToExtent'] minLines: 1,
['success']); dropDownColor: Colors.white,
Navigator.of(context) isTextFieldHasSuffix: true,
.popUntil((route) { inputFormatters: [
return route.settings.name == FilteringTextInputFormatter.allow(
PATIENTS_PROFILE; RegExp(ONLY_NUMBERS))
}); ],
Navigator.of(context).pushNamed( controller: _numberOfDayController,
ADD_SICKLEAVE, onChanged: (value) {
arguments: { setState(() {
'patient': widget.patient addSickLeave.noOfDays = value;
}); });
//print(value);
//});
} else {
try {
if (addSickLeave.noOfDays == null) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
.pleaseEnterNoOfDays);
} else if (addSickLeave.remarks ==
null) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
.pleaseEnterRemarks);
} else if (addSickLeave.startDate ==
null) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
.pleaseEnterDate);
} else {
GifLoaderDialogUtils.showMyDialog(
context);
addSickLeave.patientMRN = widget
.patient.patientMRN
.toString();
addSickLeave.appointmentNo =
widget.patient.appointmentNo
.toString();
await model2
.addSickLeave(addSickLeave);
if (model2.state ==
ViewState.ErrorLocal) {
Helpers.showErrorToast(
model2.error);
} else {
DrAppToastMsg.showSuccesToast(
TranslationBase.of(context)
.replySuccessfully);
}
GifLoaderDialogUtils.hideDialog( if (widget.extendedData != null) {
context); widget.extendedData.noOfDays =
int.parse(value);
}
},
validationError: isFormSubmitted &&
(addSickLeave.noOfDays == null)
? TranslationBase.of(context)
.pleaseEnterNoOfDays
: null,
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
height: Helpers.getTextFieldHeight(),
onClick: () {
_presentDatePicker('_selectedToDate');
},
hintText: widget.extendedData != null
? widget.extendedData.startDate
: TranslationBase.of(context)
.sickLeaveDate,
enabled: false,
maxLines: 1,
minLines: 1,
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(Icons.calendar_today)),
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(ONLY_NUMBERS))
],
controller: _toDateController,
onChanged: (value) {
setState(() {
addSickLeave.startDate = value;
});
if (widget.extendedData != null) {
widget.extendedData.startDate = value;
} }
} catch (err) { },
print(err); validationError: isFormSubmitted &&
} (addSickLeave.startDate == null)
} ? TranslationBase.of(context)
}, .pleaseEnterDate
: null,
),
SizedBox(
height: 5,
),
AppTextFieldCustom(
height: Helpers.getTextFieldHeight(),
hintText:
TranslationBase.of(context).clinicName,
enabled: false,
maxLines: 1,
minLines: 1,
dropDownColor: Colors.white,
isTextFieldHasSuffix: true,
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(ONLY_NUMBERS))
],
controller: _clinicController,
onChanged: (value) {},
),
SizedBox(
height: 10,
),
model2.sickLeaveStatistics[
'recommendedSickLeaveDays'] !=
null
? AppText(
model2.sickLeaveStatistics[
'recommendedSickLeaveDays'],
fontWeight: FontWeight.bold,
textAlign: TextAlign.start,
fontSize: 15,
)
: SizedBox(
height: 10,
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
height: Helpers.getTextFieldHeight(),
hintText:
TranslationBase.of(context).doctorName,
enabled: false,
maxLines: 1,
minLines: 1,
dropDownColor: Colors.white,
isTextFieldHasSuffix: true,
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(ONLY_NUMBERS))
],
controller: _doctorController,
onChanged: (value) {},
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
height: Helpers.getTextFieldHeight(),
hintText: widget.extendedData != null
? widget.extendedData.remarks
: TranslationBase.of(context).remarks,
maxLines: 30,
minLines: 5,
dropDownColor: Colors.white,
isTextFieldHasSuffix: true,
controller: _remarkController,
onChanged: (value) {
setState(() {
addSickLeave.remarks = value;
});
if (widget.extendedData != null) {
widget.extendedData.remarks = value;
}
},
validationError: isFormSubmitted &&
(addSickLeave.remarks == null)
? TranslationBase.of(context)
.pleaseEnterRemarks
: null,
),
],
), ),
), ),
SizedBox( ),
height: 5,
),
],
), ),
) bottomSheet: model2.state == ViewState.Busy ||
model.state == ViewState.Busy
), ? Container(
height: 0,
)
: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(
color: HexColor('#707070'), width: 0),
),
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 12 : 10),
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
),
FractionallySizedBox(
widthFactor: 0.9,
child: AppButton(
title: widget.isExtended == true
? TranslationBase.of(context).extend
: TranslationBase.of(context)
.addSickLeaverequest,
color: Colors.green,
onPressed: () async {
submitForm(model2);
}),
),
SizedBox(
height: 5,
),
],
),
)),
))); )));
} }
void _validateInputs(model2) async { submitForm(SickLeaveViewModel model2) async {
try { {
if (addSickLeave.noOfDays == null) { if (widget.isExtended) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseEnterNoOfDays); GifLoaderDialogUtils.showMyDialog(context);
} else if (addSickLeave.remarks == null) { await model2.extendSickLeave(widget.extendedData);
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseEnterRemarks);
} else if (addSickLeave.startDate == null) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseEnterDate);
} else {
addSickLeave.patientMRN = widget.patient.patientMRN.toString();
addSickLeave.appointmentNo = widget.patient.appointmentNo.toString();
await model2.addSickLeave(addSickLeave);
if (model2.state == ViewState.ErrorLocal) { if (model2.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model2.error); Helpers.showErrorToast(model2.error);
} else { } else {
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(
TranslationBase.of(context).replySuccessfully); TranslationBase.of(context).replySuccessfully);
Navigator.of(context).popUntil((route) {
return route.settings.name == PATIENTS_PROFILE;
});
Navigator.of(context)
.pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
} }
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
Navigator.of(context).popUntil((route) { } else {
return route.settings.name == PATIENTS_PROFILE; try {
}); setState(() {
Navigator.of(context) isFormSubmitted = true;
.pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient}); });
if (addSickLeave.noOfDays == null ||
addSickLeave.startDate == null ||
addSickLeave.remarks == null) {
return;
} else {
GifLoaderDialogUtils.showMyDialog(context);
addSickLeave.patientMRN = widget.patient.patientMRN.toString();
addSickLeave.appointmentNo =
widget.patient.appointmentNo.toString();
await model2.addSickLeave(addSickLeave);
if (model2.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model2.error);
} else {
DrAppToastMsg.showSuccesToast(
TranslationBase.of(context).replySuccessfully);
}
GifLoaderDialogUtils.hideDialog(context);
}
} catch (err) {
print(err);
}
} }
} catch (err) {
print(err);
} }
} }

@ -141,6 +141,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "7.1.0" version: "7.1.0"
cached_network_image:
dependency: "direct main"
description:
name: cached_network_image
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.1"
characters: characters:
dependency: transitive dependency: transitive
description: description:
@ -433,6 +440,20 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_blurhash:
dependency: transitive
description:
name: flutter_blurhash
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.0"
flutter_cache_manager:
dependency: transitive
description:
name: flutter_cache_manager
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
flutter_device_type: flutter_device_type:
dependency: "direct main" dependency: "direct main"
description: description:
@ -595,6 +616,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.4" version: "3.1.4"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.19"
imei_plugin: imei_plugin:
dependency: "direct main" dependency: "direct main"
description: description:
@ -664,7 +692,7 @@ packages:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.4" version: "1.3.0-nullsafety.3"
mime: mime:
dependency: transitive dependency: transitive
description: description:
@ -693,6 +721,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
octo_image:
dependency: transitive
description:
name: octo_image
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
open_iconic_flutter: open_iconic_flutter:
dependency: transitive dependency: transitive
description: description:
@ -728,6 +763,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.4" version: "0.1.4"
path_provider:
dependency: transitive
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.28"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
@ -735,6 +777,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.1+2" version: "0.0.1+2"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4+8"
path_provider_platform_interface: path_provider_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -854,6 +903,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.5" version: "2.1.5"
rxdart:
dependency: transitive
description:
name: rxdart
url: "https://pub.dartlang.org"
source: hosted
version: "0.25.0"
scratch_space: scratch_space:
dependency: transitive dependency: transitive
description: description:
@ -950,13 +1006,27 @@ packages:
relative: true relative: true
source: path source: path
version: "0.0.0" version: "0.0.0"
sqflite:
dependency: transitive
description:
name: sqflite
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.2+4"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3+3"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.10.0-nullsafety.2" version: "1.10.0-nullsafety.1"
sticky_headers: sticky_headers:
dependency: "direct main" dependency: "direct main"
description: description:
@ -985,6 +1055,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.1" version: "1.1.0-nullsafety.1"
synchronized:
dependency: transitive
description:
name: synchronized
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0+2"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
@ -1154,5 +1231,5 @@ packages:
source: hosted source: hosted
version: "2.2.1" version: "2.2.1"
sdks: sdks:
dart: ">=2.10.0 <=2.11.0-213.1.beta" dart: ">=2.10.2 <2.11.0"
flutter: ">=1.22.0 <2.0.0" flutter: ">=1.22.2 <2.0.0"

Loading…
Cancel
Save