Merge branch 'sultan' into 'development'
Sultan See merge request Cloud_Solution/doctor_app_flutter!197merge-requests/195/merge
commit
3ca4dceb77
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
@ -0,0 +1,31 @@
|
|||||||
|
import 'package:doctor_app_flutter/config/config.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart';
|
||||||
|
|
||||||
|
class DashboardService extends BaseService {
|
||||||
|
List<DashboardModel> _dashboardItemsList = [];
|
||||||
|
List<DashboardModel> get dashboardItemsList => _dashboardItemsList;
|
||||||
|
|
||||||
|
// DashboardModel _dashboard = DashboardModel();
|
||||||
|
|
||||||
|
Future getDashboard() async {
|
||||||
|
hasError = false;
|
||||||
|
await baseAppClient.post(
|
||||||
|
GET_DASHBOARD,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
_dashboardItemsList.clear();
|
||||||
|
response['listDoctorDashboarKPI'].forEach((v) {
|
||||||
|
_dashboardItemsList.add(DashboardModel.fromJson(v));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
// "VidaAuthTokenID":
|
||||||
|
// "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiZDYxZmM5MTQtZWFhYy00YjQ4LTgyMmEtMmE3OTNlZDMzZGYwIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NTgwOCIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgwMjg0NzQsImV4cCI6MTYwODg5MjQ3NCwiaWF0IjoxNjA4MDI4NDc0fQ.8OJcy6vUuPnNTi_qSjip8YCrFdaRLtJKbNKXcMtnQxk"
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
import 'package:doctor_app_flutter/config/config.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/sickleave/extend_sick_leave_request.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart';
|
||||||
|
// import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart';
|
||||||
|
|
||||||
|
class SickLeaveService extends BaseService {
|
||||||
|
Map get sickLeavestatisitics => _statistics;
|
||||||
|
Map _statistics = {};
|
||||||
|
|
||||||
|
List<GetAllSickLeaveResponse> get getAllSickLeave => _getAllsickLeave;
|
||||||
|
List<GetAllSickLeaveResponse> _getAllsickLeave = [];
|
||||||
|
Future getStatistics(appoNo, patientMRN) async {
|
||||||
|
hasError = false;
|
||||||
|
await baseAppClient.post(
|
||||||
|
GET_SICKLEAVE_STATISTIC,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
print(response);
|
||||||
|
_statistics = {};
|
||||||
|
_statistics = response['SickLeaveStatistics'];
|
||||||
|
},
|
||||||
|
onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
},
|
||||||
|
body: {"PatientMRN": patientMRN, "AppointmentNo": appoNo},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async {
|
||||||
|
addSickLeaveRequest.appointmentNo = '2016054661';
|
||||||
|
addSickLeaveRequest.patientMRN = '3120746';
|
||||||
|
hasError = false;
|
||||||
|
await baseAppClient.post(
|
||||||
|
ADD_SICK_LEAVE,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
Future.value(response);
|
||||||
|
print(response);
|
||||||
|
// _statistics = {};
|
||||||
|
// _statistics = response['SickLeaveStatistics'];
|
||||||
|
},
|
||||||
|
onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
},
|
||||||
|
body: addSickLeaveRequest.toJson(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future extendSickLeave(GetAllSickLeaveResponse request) async {
|
||||||
|
var extendSickLeaveRequest = ExtendSickLeaveRequest();
|
||||||
|
extendSickLeaveRequest.patientMRN =
|
||||||
|
request.patientMRN.toString(); //'3120746';
|
||||||
|
extendSickLeaveRequest.previousRequestNo = request.requestNo.toString();
|
||||||
|
extendSickLeaveRequest.noOfDays = request.noOfDays.toString();
|
||||||
|
extendSickLeaveRequest.remarks = request.remarks;
|
||||||
|
hasError = false;
|
||||||
|
await baseAppClient.post(
|
||||||
|
EXTEND_SICK_LEAVE,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
Future.value(response);
|
||||||
|
print(response);
|
||||||
|
// _statistics = {};
|
||||||
|
// _statistics = response['SickLeaveStatistics'];
|
||||||
|
},
|
||||||
|
onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
},
|
||||||
|
body: extendSickLeaveRequest.toJson(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future getSickLeave() async {
|
||||||
|
hasError = false;
|
||||||
|
await baseAppClient.post(
|
||||||
|
GET_SICK_LEAVE,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
Future.value(response);
|
||||||
|
_getAllsickLeave.clear();
|
||||||
|
response['SickLeavesList']['entityList'].forEach((v) {
|
||||||
|
_getAllsickLeave.add(GetAllSickLeaveResponse.fromJson(v));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
},
|
||||||
|
body: {'PatientMRN': 3120772},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/service/dasboard_service.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/service/medicine_service.dart';
|
||||||
|
|
||||||
|
import '../../locator.dart';
|
||||||
|
import 'base_view_model.dart';
|
||||||
|
|
||||||
|
class DashboardViewModel extends BaseViewModel {
|
||||||
|
DashboardService _dashboardService = locator<DashboardService>();
|
||||||
|
get dashboardItemsList => _dashboardService.dashboardItemsList;
|
||||||
|
|
||||||
|
Future getDashboard() async {
|
||||||
|
setState(ViewState.Busy);
|
||||||
|
await _dashboardService.getDashboard();
|
||||||
|
if (_dashboardService.hasError) {
|
||||||
|
error = _dashboardService.error;
|
||||||
|
setState(ViewState.Error);
|
||||||
|
} else
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/service/sickleave_service.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/service/medicine_service.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/sickleave/extend_sick_leave_request.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart';
|
||||||
|
|
||||||
|
import '../../locator.dart';
|
||||||
|
import 'base_view_model.dart';
|
||||||
|
|
||||||
|
class SickLeaveViewModel extends BaseViewModel {
|
||||||
|
SickLeaveService _sickLeaveService = locator<SickLeaveService>();
|
||||||
|
get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics;
|
||||||
|
get getAllSIckLeave => _sickLeaveService.getAllSickLeave;
|
||||||
|
Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async {
|
||||||
|
setState(ViewState.Busy);
|
||||||
|
await _sickLeaveService.addSickLeave(addSickLeaveRequest);
|
||||||
|
if (_sickLeaveService.hasError) {
|
||||||
|
error = _sickLeaveService.error;
|
||||||
|
setState(ViewState.Error);
|
||||||
|
} else
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future extendSickLeave(GetAllSickLeaveResponse extendSickLeaveRequest) async {
|
||||||
|
setState(ViewState.Busy);
|
||||||
|
await _sickLeaveService.extendSickLeave(extendSickLeaveRequest);
|
||||||
|
if (_sickLeaveService.hasError) {
|
||||||
|
error = _sickLeaveService.error;
|
||||||
|
setState(ViewState.Error);
|
||||||
|
} else
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future preSickLeaveStatistics(appoNo, patientMRN) async {
|
||||||
|
setState(ViewState.Busy);
|
||||||
|
await _sickLeaveService.getStatistics(appoNo, patientMRN);
|
||||||
|
if (_sickLeaveService.hasError) {
|
||||||
|
error = _sickLeaveService.error;
|
||||||
|
setState(ViewState.Error);
|
||||||
|
} else
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future getSickLeave() async {
|
||||||
|
setState(ViewState.Busy);
|
||||||
|
await _sickLeaveService.getSickLeave();
|
||||||
|
if (_sickLeaveService.hasError) {
|
||||||
|
error = _sickLeaveService.error;
|
||||||
|
setState(ViewState.Error);
|
||||||
|
} else
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
class DashboardModel {
|
||||||
|
String kPIName;
|
||||||
|
int displaySequence;
|
||||||
|
List<Summaryoptions> summaryoptions;
|
||||||
|
|
||||||
|
DashboardModel({this.kPIName, this.displaySequence, this.summaryoptions});
|
||||||
|
|
||||||
|
DashboardModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
kPIName = json['KPIName'];
|
||||||
|
displaySequence = json['displaySequence'];
|
||||||
|
if (json['summaryoptions'] != null) {
|
||||||
|
summaryoptions = new List<Summaryoptions>();
|
||||||
|
json['summaryoptions'].forEach((v) {
|
||||||
|
summaryoptions.add(new Summaryoptions.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['KPIName'] = this.kPIName;
|
||||||
|
data['displaySequence'] = this.displaySequence;
|
||||||
|
if (this.summaryoptions != null) {
|
||||||
|
data['summaryoptions'] =
|
||||||
|
this.summaryoptions.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Summaryoptions {
|
||||||
|
String kPIParameter;
|
||||||
|
String captionColor;
|
||||||
|
bool isCaptionBold;
|
||||||
|
bool isValueBold;
|
||||||
|
int order;
|
||||||
|
int value;
|
||||||
|
String valueColor;
|
||||||
|
|
||||||
|
Summaryoptions(
|
||||||
|
{this.kPIParameter,
|
||||||
|
this.captionColor,
|
||||||
|
this.isCaptionBold,
|
||||||
|
this.isValueBold,
|
||||||
|
this.order,
|
||||||
|
this.value,
|
||||||
|
this.valueColor});
|
||||||
|
|
||||||
|
Summaryoptions.fromJson(Map<String, dynamic> json) {
|
||||||
|
kPIParameter = json['KPIParameter'];
|
||||||
|
captionColor = json['captionColor'];
|
||||||
|
isCaptionBold = json['isCaptionBold'];
|
||||||
|
isValueBold = json['isValueBold'];
|
||||||
|
order = json['order'];
|
||||||
|
value = json['value'];
|
||||||
|
valueColor = json['valueColor'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['KPIParameter'] = this.kPIParameter;
|
||||||
|
data['captionColor'] = this.captionColor;
|
||||||
|
data['isCaptionBold'] = this.isCaptionBold;
|
||||||
|
data['isValueBold'] = this.isValueBold;
|
||||||
|
data['order'] = this.order;
|
||||||
|
data['value'] = this.value;
|
||||||
|
data['valueColor'] = this.valueColor;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
class AddSickLeaveRequest {
|
||||||
|
String patientMRN;
|
||||||
|
String appointmentNo;
|
||||||
|
String startDate;
|
||||||
|
String noOfDays;
|
||||||
|
String remarks;
|
||||||
|
|
||||||
|
AddSickLeaveRequest(
|
||||||
|
{this.patientMRN,
|
||||||
|
this.appointmentNo,
|
||||||
|
this.startDate,
|
||||||
|
this.noOfDays,
|
||||||
|
this.remarks});
|
||||||
|
|
||||||
|
AddSickLeaveRequest.fromJson(Map<String, dynamic> json) {
|
||||||
|
patientMRN = json['PatientMRN'];
|
||||||
|
appointmentNo = json['AppointmentNo'];
|
||||||
|
startDate = json['StartDate'];
|
||||||
|
noOfDays = json['NoOfDays'];
|
||||||
|
remarks = json['Remarks'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['PatientMRN'] = this.patientMRN;
|
||||||
|
data['AppointmentNo'] = this.appointmentNo;
|
||||||
|
data['StartDate'] = this.startDate;
|
||||||
|
data['NoOfDays'] = this.noOfDays;
|
||||||
|
data['Remarks'] = this.remarks;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
class ExtendSickLeaveRequest {
|
||||||
|
String patientMRN;
|
||||||
|
String previousRequestNo;
|
||||||
|
String noOfDays;
|
||||||
|
String remarks;
|
||||||
|
|
||||||
|
ExtendSickLeaveRequest(
|
||||||
|
{this.patientMRN, this.previousRequestNo, this.noOfDays, this.remarks});
|
||||||
|
|
||||||
|
ExtendSickLeaveRequest.fromJson(Map<String, dynamic> json) {
|
||||||
|
patientMRN = json['PatientMRN'];
|
||||||
|
previousRequestNo = json['PreviousRequestNo'];
|
||||||
|
noOfDays = json['NoOfDays'];
|
||||||
|
remarks = json['Remarks'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['PatientMRN'] = this.patientMRN;
|
||||||
|
data['PreviousRequestNo'] = this.previousRequestNo;
|
||||||
|
data['NoOfDays'] = this.noOfDays;
|
||||||
|
data['Remarks'] = this.remarks;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
class GetAllSickLeaveResponse {
|
||||||
|
int appointmentNo;
|
||||||
|
bool isExtendedLeave;
|
||||||
|
int noOfDays;
|
||||||
|
int patientMRN;
|
||||||
|
String remarks;
|
||||||
|
int requestNo;
|
||||||
|
String startDate;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
GetAllSickLeaveResponse(
|
||||||
|
{this.appointmentNo,
|
||||||
|
this.isExtendedLeave,
|
||||||
|
this.noOfDays,
|
||||||
|
this.patientMRN,
|
||||||
|
this.remarks,
|
||||||
|
this.requestNo,
|
||||||
|
this.startDate,
|
||||||
|
this.status});
|
||||||
|
|
||||||
|
GetAllSickLeaveResponse.fromJson(Map<String, dynamic> json) {
|
||||||
|
appointmentNo = json['appointmentNo'];
|
||||||
|
isExtendedLeave = json['isExtendedLeave'];
|
||||||
|
noOfDays = json['noOfDays'];
|
||||||
|
patientMRN = json['patientMRN'];
|
||||||
|
remarks = json['remarks'];
|
||||||
|
requestNo = json['requestNo'];
|
||||||
|
startDate = json['startDate'];
|
||||||
|
status = json['status'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['appointmentNo'] = this.appointmentNo;
|
||||||
|
data['isExtendedLeave'] = this.isExtendedLeave;
|
||||||
|
data['noOfDays'] = this.noOfDays;
|
||||||
|
data['patientMRN'] = this.patientMRN;
|
||||||
|
data['remarks'] = this.remarks;
|
||||||
|
data['requestNo'] = this.requestNo;
|
||||||
|
data['startDate'] = this.startDate;
|
||||||
|
data['status'] = this.status;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,192 @@
|
|||||||
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/translations_delegate_base.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/card_with_bgNew_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
|
||||||
|
class AddSickLeavScreen extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<SickLeaveViewModel>(
|
||||||
|
onModelReady: (model) => model.getSickLeave(),
|
||||||
|
builder: (_, model, w) => AppScaffold(
|
||||||
|
baseViewModel: model,
|
||||||
|
appBarTitle: TranslationBase.of(context).sickleave,
|
||||||
|
body: model.getAllSIckLeave.length > 0
|
||||||
|
? SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: model.getAllSIckLeave
|
||||||
|
.map<Widget>((GetAllSickLeaveResponse item) {
|
||||||
|
return CardWithBgWidgetNew(
|
||||||
|
widget: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(left: 10, right: 10),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 4,
|
||||||
|
child: Wrap(
|
||||||
|
// mainAxisAlignment:
|
||||||
|
// MainAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(3),
|
||||||
|
child: AppText(
|
||||||
|
item.status == 1
|
||||||
|
? TranslationBase.of(
|
||||||
|
context)
|
||||||
|
.approved
|
||||||
|
: item.status == 2
|
||||||
|
? TranslationBase
|
||||||
|
.of(context)
|
||||||
|
.extended
|
||||||
|
: TranslationBase
|
||||||
|
.of(context)
|
||||||
|
.pending,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
color: item.status == 1
|
||||||
|
? Colors.green
|
||||||
|
: Colors.yellow[800],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
TranslationBase.of(
|
||||||
|
context)
|
||||||
|
.leaveStartDate +
|
||||||
|
' ',
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.bold,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: Text(
|
||||||
|
item.startDate,
|
||||||
|
overflow:
|
||||||
|
TextOverflow.ellipsis,
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
AppText(
|
||||||
|
item.noOfDays.toString() +
|
||||||
|
' ' +
|
||||||
|
TranslationBase.of(
|
||||||
|
context)
|
||||||
|
.daysSickleave,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
Row(children: [
|
||||||
|
AppText(
|
||||||
|
item.remarks,
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 20,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(item.status == 1 || item.status == 2)
|
||||||
|
? Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.open_in_full,
|
||||||
|
size: 40,
|
||||||
|
),
|
||||||
|
// color: Colors.green, //Colors.black,
|
||||||
|
onPressed: () => {
|
||||||
|
openSickLeave(context, true,
|
||||||
|
extendedData: item)
|
||||||
|
},
|
||||||
|
))
|
||||||
|
: SizedBox(),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Divider(
|
||||||
|
height: 1,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: new Builder(builder: (context) {
|
||||||
|
return Center(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(40),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
color: HexColor('#B8382C'), width: 4),
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(100))),
|
||||||
|
child: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.add,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
openSickLeave(
|
||||||
|
context,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
child: AppText(
|
||||||
|
TranslationBase.of(context).noSickLeaveApplied,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
),
|
||||||
|
AppText(
|
||||||
|
TranslationBase.of(context).applyNow,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: HexColor('#B8382C'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
openSickLeave(BuildContext context, isExtend,
|
||||||
|
{GetAllSickLeaveResponse extendedData}) {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return new Container(
|
||||||
|
child: SickLeaveScreen(
|
||||||
|
appointmentNo: extendedData.appointmentNo,
|
||||||
|
patientMRN: extendedData.patientMRN,
|
||||||
|
isExtended: isExtend,
|
||||||
|
extendedData: extendedData,
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,379 @@
|
|||||||
|
import 'package:doctor_app_flutter/config/config.dart';
|
||||||
|
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
||||||
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/helpers.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/text_validator.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/Text.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_text_form_field.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart';
|
||||||
|
|
||||||
|
Helpers helpers = Helpers();
|
||||||
|
|
||||||
|
class SickLeaveScreen extends StatefulWidget {
|
||||||
|
final bool isExtended;
|
||||||
|
final GetAllSickLeaveResponse extendedData;
|
||||||
|
final appointmentNo;
|
||||||
|
final patientMRN;
|
||||||
|
SickLeaveScreen(
|
||||||
|
{this.appointmentNo,
|
||||||
|
this.patientMRN,
|
||||||
|
this.isExtended = false,
|
||||||
|
this.extendedData});
|
||||||
|
@override
|
||||||
|
_SickLeaveScreenState createState() => _SickLeaveScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SickLeaveScreenState extends State<SickLeaveScreen> {
|
||||||
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
||||||
|
TextEditingController _toDateController = new TextEditingController();
|
||||||
|
String _selectedClinic;
|
||||||
|
Map profile = {};
|
||||||
|
AddSickLeaveRequest addSickLeave = AddSickLeaveRequest();
|
||||||
|
void _presentDatePicker(id) {
|
||||||
|
showDatePicker(
|
||||||
|
context: context,
|
||||||
|
initialDate: DateTime.now(),
|
||||||
|
firstDate: DateTime(2019),
|
||||||
|
lastDate: DateTime.now(),
|
||||||
|
).then((pickedDate) {
|
||||||
|
if (pickedDate == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
// var selectedDate = DateFormat.yMd().format(pickedDate);
|
||||||
|
final df = new DateFormat('yyyy-MM-dd');
|
||||||
|
addSickLeave.startDate = df.format(pickedDate);
|
||||||
|
|
||||||
|
_toDateController.text = addSickLeave.startDate;
|
||||||
|
//addSickLeave.startDate = selectedDate;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
getProfile();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<PatientViewModel>(
|
||||||
|
onModelReady: (model) => model.getClinicsList(),
|
||||||
|
builder: (_, model, w) => BaseView<SickLeaveViewModel>(
|
||||||
|
onModelReady: (model2) => model2.preSickLeaveStatistics(
|
||||||
|
widget.appointmentNo, widget.patientMRN),
|
||||||
|
builder: (_, model2, w) => AppScaffold(
|
||||||
|
baseViewModel: model2,
|
||||||
|
isShowAppBar: false,
|
||||||
|
body: Center(
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.only(top: 10),
|
||||||
|
child: FractionallySizedBox(
|
||||||
|
widthFactor: 0.9,
|
||||||
|
child: ListView(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
child: AppText(
|
||||||
|
widget.isExtended == true
|
||||||
|
? TranslationBase.of(context)
|
||||||
|
.extendSickLeave
|
||||||
|
: TranslationBase.of(context)
|
||||||
|
.addSickLeave,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.all(10)),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(left: 10, right: 10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(6.0)),
|
||||||
|
border: Border.all(
|
||||||
|
width: 1.0, color: HexColor("#CCCCCC"))),
|
||||||
|
padding: EdgeInsets.all(5),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
AppTextFormField(
|
||||||
|
borderColor: Colors.white,
|
||||||
|
onChanged: (value) {
|
||||||
|
addSickLeave.noOfDays = value;
|
||||||
|
},
|
||||||
|
hintText: widget.extendedData != null
|
||||||
|
? widget.extendedData.noOfDays
|
||||||
|
.toString()
|
||||||
|
: TranslationBase.of(context)
|
||||||
|
.sickLeaveDays,
|
||||||
|
// validator: (value) {
|
||||||
|
// return TextValidator().validateName(value);
|
||||||
|
// },
|
||||||
|
inputFormatter: ONLY_NUMBERS)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(left: 10, right: 10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(6.0)),
|
||||||
|
border: Border.all(
|
||||||
|
width: 1.0,
|
||||||
|
color: HexColor("#CCCCCC"))),
|
||||||
|
padding: EdgeInsets.all(5),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// AppText(
|
||||||
|
// TranslationBase.of(context).sickLeaveDate,
|
||||||
|
// fontSize: 10,
|
||||||
|
// ),
|
||||||
|
AppTextFormField(
|
||||||
|
hintText: widget.extendedData != null
|
||||||
|
? widget.extendedData.startDate
|
||||||
|
: TranslationBase.of(context)
|
||||||
|
.sickLeaveDate,
|
||||||
|
borderColor: Colors.white,
|
||||||
|
prefix: IconButton(
|
||||||
|
icon: Icon(Icons.calendar_today)),
|
||||||
|
textInputType: TextInputType.number,
|
||||||
|
controller: _toDateController,
|
||||||
|
onTap: () {
|
||||||
|
_presentDatePicker('_selectedToDate');
|
||||||
|
},
|
||||||
|
inputFormatter: ONLY_DATE,
|
||||||
|
onChanged: (value) {
|
||||||
|
addSickLeave.startDate = value;
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
top: 10, left: 10, right: 10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(6.0)),
|
||||||
|
border: Border.all(
|
||||||
|
width: 1.0,
|
||||||
|
color: HexColor("#CCCCCC"))),
|
||||||
|
width: double.infinity,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: SizeConfig.widthMultiplier * 0.9,
|
||||||
|
bottom: SizeConfig.widthMultiplier * 0.9,
|
||||||
|
right: SizeConfig.widthMultiplier * 3,
|
||||||
|
left: SizeConfig.widthMultiplier * 3),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// AppText(
|
||||||
|
// TranslationBase.of(context).clinicName,
|
||||||
|
// fontSize: 10,
|
||||||
|
// ),
|
||||||
|
Row(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
// add Expanded to have your dropdown button fill remaining space
|
||||||
|
child: DropdownButtonHideUnderline(
|
||||||
|
child: new IgnorePointer(
|
||||||
|
ignoring: true,
|
||||||
|
child: DropdownButton(
|
||||||
|
isExpanded: true,
|
||||||
|
value: getClinicName(
|
||||||
|
model) ??
|
||||||
|
"",
|
||||||
|
iconSize: 40,
|
||||||
|
elevation: 16,
|
||||||
|
selectedItemBuilder:
|
||||||
|
(BuildContext
|
||||||
|
context) {
|
||||||
|
return model
|
||||||
|
.getClinicNameList()
|
||||||
|
.map((item) {
|
||||||
|
return Row(
|
||||||
|
mainAxisSize:
|
||||||
|
MainAxisSize
|
||||||
|
.max,
|
||||||
|
children: <Widget>[
|
||||||
|
AppText(
|
||||||
|
item,
|
||||||
|
fontSize: SizeConfig
|
||||||
|
.textMultiplier *
|
||||||
|
2.1,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
},
|
||||||
|
onChanged: (newValue) =>
|
||||||
|
{},
|
||||||
|
items: model
|
||||||
|
.getClinicNameList()
|
||||||
|
.map((item) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value:
|
||||||
|
item.toString(),
|
||||||
|
child: Text(
|
||||||
|
item,
|
||||||
|
textAlign:
|
||||||
|
TextAlign.end,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
))),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
model2.sickLeaveStatistics[
|
||||||
|
'recommendedSickLeaveDays'] !=
|
||||||
|
null
|
||||||
|
? Padding(
|
||||||
|
child: AppText(
|
||||||
|
model2.sickLeaveStatistics[
|
||||||
|
'recommendedSickLeaveDays'],
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
)
|
||||||
|
: SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(left: 10, right: 10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(6.0)),
|
||||||
|
border: Border.all(
|
||||||
|
width: 1.0, color: HexColor("#CCCCCC"))),
|
||||||
|
padding: EdgeInsets.all(5),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// AppText(
|
||||||
|
// TranslationBase.of(context).doctorName,
|
||||||
|
// fontSize: 10,
|
||||||
|
// ),
|
||||||
|
new IgnorePointer(
|
||||||
|
ignoring: true,
|
||||||
|
child: AppTextFormField(
|
||||||
|
readOnly: true,
|
||||||
|
hintText: profile['DoctorName'],
|
||||||
|
borderColor: Colors.white,
|
||||||
|
onSaved: (value) {},
|
||||||
|
// validator: (value) {
|
||||||
|
// return TextValidator().validateName(value);
|
||||||
|
// },
|
||||||
|
inputFormatter: ONLY_NUMBERS))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(left: 10, right: 10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(6.0)),
|
||||||
|
border: Border.all(
|
||||||
|
width: 1.0, color: HexColor("#CCCCCC"))),
|
||||||
|
padding: EdgeInsets.all(5),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// AppText(
|
||||||
|
// TranslationBase.of(context).remarks,
|
||||||
|
// fontSize: 10,
|
||||||
|
// ),
|
||||||
|
AppTextFormField(
|
||||||
|
borderColor: Colors.white,
|
||||||
|
hintText: widget.extendedData != null
|
||||||
|
? widget.extendedData.remarks
|
||||||
|
: TranslationBase.of(context).remarks,
|
||||||
|
onChanged: (value) {
|
||||||
|
addSickLeave.remarks = value;
|
||||||
|
},
|
||||||
|
validator: (value) {
|
||||||
|
// return TextValidator().validateName(value);
|
||||||
|
},
|
||||||
|
inputFormatter: ONLY_LETTERS)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(
|
||||||
|
SizeConfig.widthMultiplier * 5),
|
||||||
|
child: Wrap(
|
||||||
|
alignment: WrapAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
AppButton(
|
||||||
|
title: widget.isExtended == true
|
||||||
|
? TranslationBase.of(context).extend
|
||||||
|
: TranslationBase.of(context).add,
|
||||||
|
onPressed: () {
|
||||||
|
if (widget.isExtended) {
|
||||||
|
model2
|
||||||
|
.extendSickLeave(
|
||||||
|
widget.extendedData)
|
||||||
|
.then((value) => (value) {
|
||||||
|
print(value);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
model2
|
||||||
|
.addSickLeave(addSickLeave)
|
||||||
|
.then((value) => print(value));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Column(
|
||||||
|
// children: [
|
||||||
|
// Texts(TranslationBase.of(context)
|
||||||
|
// .previousSickLeaveIssue +
|
||||||
|
// ' ')
|
||||||
|
// ],
|
||||||
|
// )
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
getProfile() async {
|
||||||
|
Map p = await sharedPref.getObj(DOCTOR_PROFILE);
|
||||||
|
setState(() {
|
||||||
|
this.profile = p;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getClinicName(model) {
|
||||||
|
var clinicInfo = model.clinicsList
|
||||||
|
.where((i) => i['ClinicID'] == this.profile['ClinicID'])
|
||||||
|
.toList();
|
||||||
|
return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class MedicationDetails extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
AppText('MEDICATION'),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue