Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into fix_home_design
Conflicts: lib/locator.dart lib/screens/home/home_screen.dartmerge-requests/675/head
commit
16dac03b24
@ -0,0 +1,120 @@
|
||||
class ProcedureTempleteRequestModel {
|
||||
int doctorID;
|
||||
String firstName;
|
||||
String middleName;
|
||||
String lastName;
|
||||
String patientMobileNumber;
|
||||
String patientIdentificationID;
|
||||
int patientID;
|
||||
String from;
|
||||
String to;
|
||||
int searchType;
|
||||
String mobileNo;
|
||||
String identificationNo;
|
||||
int editedBy;
|
||||
int projectID;
|
||||
int clinicID;
|
||||
String tokenID;
|
||||
int languageID;
|
||||
String stamp;
|
||||
String iPAdress;
|
||||
double versionID;
|
||||
int channel;
|
||||
String sessionID;
|
||||
bool isLoginForDoctorApp;
|
||||
bool patientOutSA;
|
||||
String vidaAuthTokenID;
|
||||
String vidaRefreshTokenID;
|
||||
int deviceTypeID;
|
||||
|
||||
ProcedureTempleteRequestModel(
|
||||
{this.doctorID,
|
||||
this.firstName,
|
||||
this.middleName,
|
||||
this.lastName,
|
||||
this.patientMobileNumber,
|
||||
this.patientIdentificationID,
|
||||
this.patientID,
|
||||
this.from,
|
||||
this.to,
|
||||
this.searchType,
|
||||
this.mobileNo,
|
||||
this.identificationNo,
|
||||
this.editedBy,
|
||||
this.projectID,
|
||||
this.clinicID,
|
||||
this.tokenID,
|
||||
this.languageID,
|
||||
this.stamp,
|
||||
this.iPAdress,
|
||||
this.versionID,
|
||||
this.channel,
|
||||
this.sessionID,
|
||||
this.isLoginForDoctorApp,
|
||||
this.patientOutSA,
|
||||
this.vidaAuthTokenID,
|
||||
this.vidaRefreshTokenID,
|
||||
this.deviceTypeID});
|
||||
|
||||
ProcedureTempleteRequestModel.fromJson(Map<String, dynamic> json) {
|
||||
doctorID = json['DoctorID'];
|
||||
firstName = json['FirstName'];
|
||||
middleName = json['MiddleName'];
|
||||
lastName = json['LastName'];
|
||||
patientMobileNumber = json['PatientMobileNumber'];
|
||||
patientIdentificationID = json['PatientIdentificationID'];
|
||||
patientID = json['PatientID'];
|
||||
from = json['From'];
|
||||
to = json['To'];
|
||||
searchType = json['SearchType'];
|
||||
mobileNo = json['MobileNo'];
|
||||
identificationNo = json['IdentificationNo'];
|
||||
editedBy = json['EditedBy'];
|
||||
projectID = json['ProjectID'];
|
||||
clinicID = json['ClinicID'];
|
||||
tokenID = json['TokenID'];
|
||||
languageID = json['LanguageID'];
|
||||
stamp = json['stamp'];
|
||||
iPAdress = json['IPAdress'];
|
||||
versionID = json['VersionID'];
|
||||
channel = json['Channel'];
|
||||
sessionID = json['SessionID'];
|
||||
isLoginForDoctorApp = json['IsLoginForDoctorApp'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
vidaAuthTokenID = json['VidaAuthTokenID'];
|
||||
vidaRefreshTokenID = json['VidaRefreshTokenID'];
|
||||
deviceTypeID = json['DeviceTypeID'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['DoctorID'] = this.doctorID;
|
||||
data['FirstName'] = this.firstName;
|
||||
data['MiddleName'] = this.middleName;
|
||||
data['LastName'] = this.lastName;
|
||||
data['PatientMobileNumber'] = this.patientMobileNumber;
|
||||
data['PatientIdentificationID'] = this.patientIdentificationID;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['From'] = this.from;
|
||||
data['To'] = this.to;
|
||||
data['SearchType'] = this.searchType;
|
||||
data['MobileNo'] = this.mobileNo;
|
||||
data['IdentificationNo'] = this.identificationNo;
|
||||
data['EditedBy'] = this.editedBy;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['ClinicID'] = this.clinicID;
|
||||
data['TokenID'] = this.tokenID;
|
||||
data['LanguageID'] = this.languageID;
|
||||
data['stamp'] = this.stamp;
|
||||
data['IPAdress'] = this.iPAdress;
|
||||
data['VersionID'] = this.versionID;
|
||||
data['Channel'] = this.channel;
|
||||
data['SessionID'] = this.sessionID;
|
||||
data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp;
|
||||
data['PatientOutSA'] = this.patientOutSA;
|
||||
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
|
||||
data['VidaRefreshTokenID'] = this.vidaRefreshTokenID;
|
||||
data['DeviceTypeID'] = this.deviceTypeID;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
class ProcedureTempleteModel {
|
||||
String setupID;
|
||||
int projectID;
|
||||
int clinicID;
|
||||
int doctorID;
|
||||
int templateID;
|
||||
String templateName;
|
||||
bool isActive;
|
||||
int createdBy;
|
||||
String createdOn;
|
||||
dynamic editedBy;
|
||||
dynamic editedOn;
|
||||
|
||||
ProcedureTempleteModel(
|
||||
{this.setupID,
|
||||
this.projectID,
|
||||
this.clinicID,
|
||||
this.doctorID,
|
||||
this.templateID,
|
||||
this.templateName,
|
||||
this.isActive,
|
||||
this.createdBy,
|
||||
this.createdOn,
|
||||
this.editedBy,
|
||||
this.editedOn});
|
||||
|
||||
ProcedureTempleteModel.fromJson(Map<String, dynamic> json) {
|
||||
setupID = json['SetupID'];
|
||||
projectID = json['ProjectID'];
|
||||
clinicID = json['ClinicID'];
|
||||
doctorID = json['DoctorID'];
|
||||
templateID = json['TemplateID'];
|
||||
templateName = json['TemplateName'];
|
||||
isActive = json['IsActive'];
|
||||
createdBy = json['CreatedBy'];
|
||||
createdOn = json['CreatedOn'];
|
||||
editedBy = json['EditedBy'];
|
||||
editedOn = json['EditedOn'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['SetupID'] = this.setupID;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['ClinicID'] = this.clinicID;
|
||||
data['DoctorID'] = this.doctorID;
|
||||
data['TemplateID'] = this.templateID;
|
||||
data['TemplateName'] = this.templateName;
|
||||
data['IsActive'] = this.isActive;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['CreatedOn'] = this.createdOn;
|
||||
data['EditedBy'] = this.editedBy;
|
||||
data['EditedOn'] = this.editedOn;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
class ProcedureTempleteDetailsModel {
|
||||
String setupID;
|
||||
int projectID;
|
||||
int clinicID;
|
||||
int doctorID;
|
||||
int templateID;
|
||||
String procedureID;
|
||||
bool isActive;
|
||||
int createdBy;
|
||||
String createdOn;
|
||||
dynamic editedBy;
|
||||
dynamic editedOn;
|
||||
String procedureName;
|
||||
String procedureNameN;
|
||||
String alias;
|
||||
String aliasN;
|
||||
String categoryID;
|
||||
String subGroupID;
|
||||
dynamic riskCategoryID;
|
||||
|
||||
ProcedureTempleteDetailsModel(
|
||||
{this.setupID,
|
||||
this.projectID,
|
||||
this.clinicID,
|
||||
this.doctorID,
|
||||
this.templateID,
|
||||
this.procedureID,
|
||||
this.isActive,
|
||||
this.createdBy,
|
||||
this.createdOn,
|
||||
this.editedBy,
|
||||
this.editedOn,
|
||||
this.procedureName,
|
||||
this.procedureNameN,
|
||||
this.alias,
|
||||
this.aliasN,
|
||||
this.categoryID,
|
||||
this.subGroupID,
|
||||
this.riskCategoryID});
|
||||
|
||||
ProcedureTempleteDetailsModel.fromJson(Map<String, dynamic> json) {
|
||||
setupID = json['SetupID'];
|
||||
projectID = json['ProjectID'];
|
||||
clinicID = json['ClinicID'];
|
||||
doctorID = json['DoctorID'];
|
||||
templateID = json['TemplateID'];
|
||||
procedureID = json['ProcedureID'];
|
||||
isActive = json['IsActive'];
|
||||
createdBy = json['CreatedBy'];
|
||||
createdOn = json['CreatedOn'];
|
||||
editedBy = json['EditedBy'];
|
||||
editedOn = json['EditedOn'];
|
||||
procedureName = json['ProcedureName'];
|
||||
procedureNameN = json['ProcedureNameN'];
|
||||
alias = json['Alias'];
|
||||
aliasN = json['AliasN'];
|
||||
categoryID = json['CategoryID'];
|
||||
subGroupID = json['SubGroupID'];
|
||||
riskCategoryID = json['RiskCategoryID'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['SetupID'] = this.setupID;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['ClinicID'] = this.clinicID;
|
||||
data['DoctorID'] = this.doctorID;
|
||||
data['TemplateID'] = this.templateID;
|
||||
data['ProcedureID'] = this.procedureID;
|
||||
data['IsActive'] = this.isActive;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['CreatedOn'] = this.createdOn;
|
||||
data['EditedBy'] = this.editedBy;
|
||||
data['EditedOn'] = this.editedOn;
|
||||
data['ProcedureName'] = this.procedureName;
|
||||
data['ProcedureNameN'] = this.procedureNameN;
|
||||
data['Alias'] = this.alias;
|
||||
data['AliasN'] = this.aliasN;
|
||||
data['CategoryID'] = this.categoryID;
|
||||
data['SubGroupID'] = this.subGroupID;
|
||||
data['RiskCategoryID'] = this.riskCategoryID;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,124 @@
|
||||
class ProcedureTempleteDetailsRequestModel {
|
||||
int doctorID;
|
||||
String firstName;
|
||||
int templateID;
|
||||
String middleName;
|
||||
String lastName;
|
||||
String patientMobileNumber;
|
||||
String patientIdentificationID;
|
||||
int patientID;
|
||||
String from;
|
||||
String to;
|
||||
int searchType;
|
||||
String mobileNo;
|
||||
String identificationNo;
|
||||
int editedBy;
|
||||
int projectID;
|
||||
int clinicID;
|
||||
String tokenID;
|
||||
int languageID;
|
||||
String stamp;
|
||||
String iPAdress;
|
||||
double versionID;
|
||||
int channel;
|
||||
String sessionID;
|
||||
bool isLoginForDoctorApp;
|
||||
bool patientOutSA;
|
||||
String vidaAuthTokenID;
|
||||
String vidaRefreshTokenID;
|
||||
int deviceTypeID;
|
||||
|
||||
ProcedureTempleteDetailsRequestModel(
|
||||
{this.doctorID,
|
||||
this.firstName,
|
||||
this.templateID,
|
||||
this.middleName,
|
||||
this.lastName,
|
||||
this.patientMobileNumber,
|
||||
this.patientIdentificationID,
|
||||
this.patientID,
|
||||
this.from,
|
||||
this.to,
|
||||
this.searchType,
|
||||
this.mobileNo,
|
||||
this.identificationNo,
|
||||
this.editedBy,
|
||||
this.projectID,
|
||||
this.clinicID,
|
||||
this.tokenID,
|
||||
this.languageID,
|
||||
this.stamp,
|
||||
this.iPAdress,
|
||||
this.versionID,
|
||||
this.channel,
|
||||
this.sessionID,
|
||||
this.isLoginForDoctorApp,
|
||||
this.patientOutSA,
|
||||
this.vidaAuthTokenID,
|
||||
this.vidaRefreshTokenID,
|
||||
this.deviceTypeID});
|
||||
|
||||
ProcedureTempleteDetailsRequestModel.fromJson(Map<String, dynamic> json) {
|
||||
doctorID = json['DoctorID'];
|
||||
firstName = json['FirstName'];
|
||||
templateID = json['TemplateID'];
|
||||
middleName = json['MiddleName'];
|
||||
lastName = json['LastName'];
|
||||
patientMobileNumber = json['PatientMobileNumber'];
|
||||
patientIdentificationID = json['PatientIdentificationID'];
|
||||
patientID = json['PatientID'];
|
||||
from = json['From'];
|
||||
to = json['To'];
|
||||
searchType = json['SearchType'];
|
||||
mobileNo = json['MobileNo'];
|
||||
identificationNo = json['IdentificationNo'];
|
||||
editedBy = json['EditedBy'];
|
||||
projectID = json['ProjectID'];
|
||||
clinicID = json['ClinicID'];
|
||||
tokenID = json['TokenID'];
|
||||
languageID = json['LanguageID'];
|
||||
stamp = json['stamp'];
|
||||
iPAdress = json['IPAdress'];
|
||||
versionID = json['VersionID'];
|
||||
channel = json['Channel'];
|
||||
sessionID = json['SessionID'];
|
||||
isLoginForDoctorApp = json['IsLoginForDoctorApp'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
vidaAuthTokenID = json['VidaAuthTokenID'];
|
||||
vidaRefreshTokenID = json['VidaRefreshTokenID'];
|
||||
deviceTypeID = json['DeviceTypeID'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['DoctorID'] = this.doctorID;
|
||||
data['FirstName'] = this.firstName;
|
||||
data['TemplateID'] = this.templateID;
|
||||
data['MiddleName'] = this.middleName;
|
||||
data['LastName'] = this.lastName;
|
||||
data['PatientMobileNumber'] = this.patientMobileNumber;
|
||||
data['PatientIdentificationID'] = this.patientIdentificationID;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['From'] = this.from;
|
||||
data['To'] = this.to;
|
||||
data['SearchType'] = this.searchType;
|
||||
data['MobileNo'] = this.mobileNo;
|
||||
data['IdentificationNo'] = this.identificationNo;
|
||||
data['EditedBy'] = this.editedBy;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['ClinicID'] = this.clinicID;
|
||||
data['TokenID'] = this.tokenID;
|
||||
data['LanguageID'] = this.languageID;
|
||||
data['stamp'] = this.stamp;
|
||||
data['IPAdress'] = this.iPAdress;
|
||||
data['VersionID'] = this.versionID;
|
||||
data['Channel'] = this.channel;
|
||||
data['SessionID'] = this.sessionID;
|
||||
data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp;
|
||||
data['PatientOutSA'] = this.patientOutSA;
|
||||
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
|
||||
data['VidaRefreshTokenID'] = this.vidaRefreshTokenID;
|
||||
data['DeviceTypeID'] = this.deviceTypeID;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
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/patient/MedicalReport/MedicalReportTemplate.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
|
||||
class PatientMedicalReportService extends BaseService {
|
||||
List<MedicalReportModel> medicalReportList = [];
|
||||
List<MedicalReportTemplate> medicalReportTemplate = [];
|
||||
|
||||
Future getMedicalReportList(PatiantInformtion patient) async {
|
||||
hasError = false;
|
||||
Map<String, dynamic> body = Map();
|
||||
// body['TokenID'] = "@dm!n";
|
||||
body['SetupID'] = "91877";
|
||||
body['AdmissionNo'] = patient.admissionNo;
|
||||
|
||||
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_GET_LIST,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
|
||||
medicalReportList.clear();
|
||||
if (response['DAPP_ListMedicalReportList'] != null) {
|
||||
response['DAPP_ListMedicalReportList'].forEach((v) {
|
||||
medicalReportList.add(MedicalReportModel.fromJson(v));
|
||||
});
|
||||
}
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error.toString();
|
||||
}, body: body, patient: patient);
|
||||
}
|
||||
|
||||
Future getMedicalReportTemplate() async {
|
||||
hasError = false;
|
||||
Map<String, dynamic> body = Map();
|
||||
body['TokenID'] = "@dm!n";
|
||||
body['SetupID'] = "91877";
|
||||
body['TemplateID'] = 43;
|
||||
|
||||
await baseAppClient.post(PATIENT_MEDICAL_REPORT_GET_TEMPLATE,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
|
||||
medicalReportTemplate.clear();
|
||||
if (response['DAPP_GetTemplateByIDList'] != null) {
|
||||
response['DAPP_GetTemplateByIDList'].forEach((v) {
|
||||
medicalReportTemplate.add(MedicalReportTemplate.fromJson(v));
|
||||
});
|
||||
}
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error.toString();
|
||||
}, body: body);
|
||||
}
|
||||
|
||||
Future insertMedicalReport(PatiantInformtion patient, String htmlText) async {
|
||||
hasError = false;
|
||||
Map<String, dynamic> body = Map();
|
||||
// body['TokenID'] = "@dm!n";
|
||||
body['SetupID'] = "91877";
|
||||
body['AdmissionNo'] = patient.admissionNo;
|
||||
body['MedicalReportHTML'] = htmlText;
|
||||
|
||||
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_INSERT,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error.toString();
|
||||
}, body: body, patient: patient);
|
||||
}
|
||||
|
||||
Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport) async {
|
||||
hasError = false;
|
||||
Map<String, dynamic> body = Map();
|
||||
body['TokenID'] = "@dm!n";
|
||||
body['SetupID'] = "91877";
|
||||
body['AdmissionNo'] = patient.admissionNo;
|
||||
body['InvoiceNo'] = medicalReport.invoiceNo;
|
||||
body['LineItemNo'] = medicalReport.lineItemNo;
|
||||
|
||||
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_VERIFIED,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error.toString();
|
||||
}, body: body, patient: patient);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/MedicalReport/MedicalReportTemplate.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
|
||||
import '../../locator.dart';
|
||||
|
||||
class PatientMedicalReportViewModel extends BaseViewModel {
|
||||
PatientMedicalReportService _service = locator<PatientMedicalReportService>();
|
||||
|
||||
List<MedicalReportModel> get medicalReportList => _service.medicalReportList;
|
||||
|
||||
List<MedicalReportTemplate> get medicalReportTemplate =>
|
||||
_service.medicalReportTemplate;
|
||||
|
||||
Future getMedicalReportList(PatiantInformtion patient) async {
|
||||
setState(ViewState.Busy);
|
||||
await _service.getMedicalReportList(patient);
|
||||
if (_service.hasError) {
|
||||
error = _service.error;
|
||||
setState(ViewState.ErrorLocal); // ViewState.Error
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
|
||||
Future getMedicalReportTemplate() async {
|
||||
setState(ViewState.Busy);
|
||||
await _service.getMedicalReportTemplate();
|
||||
if (_service.hasError) {
|
||||
error = _service.error;
|
||||
setState(ViewState.Error);
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
|
||||
Future insertMedicalReport(PatiantInformtion patient, String htmlText) async {
|
||||
setState(ViewState.Busy);
|
||||
await _service.insertMedicalReport(patient, htmlText);
|
||||
if (_service.hasError) {
|
||||
error = _service.error;
|
||||
setState(ViewState.ErrorLocal);
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
|
||||
Future verifyMedicalReport(
|
||||
PatiantInformtion patient, MedicalReportModel medicalReport) async {
|
||||
setState(ViewState.Busy);
|
||||
await _service.verifyMedicalReport(patient, medicalReport);
|
||||
if (_service.hasError) {
|
||||
error = _service.error;
|
||||
setState(ViewState.ErrorLocal);
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
class MedicalReportTemplate {
|
||||
String setupID;
|
||||
int projectID;
|
||||
int templateID;
|
||||
String procedureID;
|
||||
int reportType;
|
||||
String templateName;
|
||||
String templateNameN;
|
||||
String templateText;
|
||||
String templateTextN;
|
||||
bool isActive;
|
||||
String templateTextHtml;
|
||||
String templateTextNHtml;
|
||||
|
||||
MedicalReportTemplate(
|
||||
{this.setupID,
|
||||
this.projectID,
|
||||
this.templateID,
|
||||
this.procedureID,
|
||||
this.reportType,
|
||||
this.templateName,
|
||||
this.templateNameN,
|
||||
this.templateText,
|
||||
this.templateTextN,
|
||||
this.isActive,
|
||||
this.templateTextHtml,
|
||||
this.templateTextNHtml});
|
||||
|
||||
MedicalReportTemplate.fromJson(Map<String, dynamic> json) {
|
||||
setupID = json['SetupID'];
|
||||
projectID = json['ProjectID'];
|
||||
templateID = json['TemplateID'];
|
||||
procedureID = json['ProcedureID'];
|
||||
reportType = json['ReportType'];
|
||||
templateName = json['TemplateName'];
|
||||
templateNameN = json['TemplateNameN'];
|
||||
templateText = json['TemplateText'];
|
||||
templateTextN = json['TemplateTextN'];
|
||||
isActive = json['IsActive'];
|
||||
templateTextHtml = json['TemplateTextHtml'];
|
||||
templateTextNHtml = json['TemplateTextNHtml'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['SetupID'] = this.setupID;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['TemplateID'] = this.templateID;
|
||||
data['ProcedureID'] = this.procedureID;
|
||||
data['ReportType'] = this.reportType;
|
||||
data['TemplateName'] = this.templateName;
|
||||
data['TemplateNameN'] = this.templateNameN;
|
||||
data['TemplateText'] = this.templateText;
|
||||
data['TemplateTextN'] = this.templateTextN;
|
||||
data['IsActive'] = this.isActive;
|
||||
data['TemplateTextHtml'] = this.templateTextHtml;
|
||||
data['TemplateTextNHtml'] = this.templateTextNHtml;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
class MedicalReportModel {
|
||||
String reportData;
|
||||
String setupID;
|
||||
int projectID;
|
||||
int patientID;
|
||||
String invoiceNo;
|
||||
int status;
|
||||
String verifiedOn;
|
||||
int verifiedBy;
|
||||
String editedOn;
|
||||
int editedBy;
|
||||
int lineItemNo;
|
||||
String reportDataHtml;
|
||||
|
||||
MedicalReportModel(
|
||||
{this.reportData,
|
||||
this.setupID,
|
||||
this.projectID,
|
||||
this.patientID,
|
||||
this.invoiceNo,
|
||||
this.status,
|
||||
this.verifiedOn,
|
||||
this.verifiedBy,
|
||||
this.editedOn,
|
||||
this.editedBy,
|
||||
this.lineItemNo,
|
||||
this.reportDataHtml});
|
||||
|
||||
MedicalReportModel.fromJson(Map<String, dynamic> json) {
|
||||
reportData = json['ReportData'];
|
||||
setupID = json['SetupID'];
|
||||
projectID = json['ProjectID'];
|
||||
patientID = json['PatientID'];
|
||||
invoiceNo = json['InvoiceNo'];
|
||||
status = json['Status'];
|
||||
verifiedOn = json['VerifiedOn'];
|
||||
verifiedBy = json['VerifiedBy'];
|
||||
editedOn = json['EditedOn'];
|
||||
editedBy = json['EditedBy'];
|
||||
lineItemNo = json['LineItemNo'];
|
||||
reportDataHtml = json['ReportDataHtml'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ReportData'] = this.reportData;
|
||||
data['SetupID'] = this.setupID;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['InvoiceNo'] = this.invoiceNo;
|
||||
data['Status'] = this.status;
|
||||
data['VerifiedOn'] = this.verifiedOn;
|
||||
data['VerifiedBy'] = this.verifiedBy;
|
||||
data['EditedOn'] = this.editedOn;
|
||||
data['EditedBy'] = this.editedBy;
|
||||
data['LineItemNo'] = this.lineItemNo;
|
||||
data['ReportDataHtml'] = this.reportDataHtml;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,147 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
|
||||
import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart';
|
||||
import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/screens/procedures/entity_list_checkbox_search_widget.dart';
|
||||
import 'package:doctor_app_flutter/screens/procedures/entity_list_fav_procedure.dart';
|
||||
import 'package:doctor_app_flutter/util/dr_app_toast_msg.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/buttons/app_buttons_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class AddFavouriteProcedure extends StatefulWidget {
|
||||
final ProcedureViewModel model;
|
||||
final PatiantInformtion patient;
|
||||
|
||||
const AddFavouriteProcedure({Key key, this.model, this.patient})
|
||||
: super(key: key);
|
||||
@override
|
||||
_AddFavouriteProcedureState createState() => _AddFavouriteProcedureState();
|
||||
}
|
||||
|
||||
class _AddFavouriteProcedureState extends State<AddFavouriteProcedure> {
|
||||
_AddFavouriteProcedureState({this.patient, this.model});
|
||||
ProcedureViewModel model;
|
||||
PatiantInformtion patient;
|
||||
List<ProcedureTempleteDetailsModel> entityList = List();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<ProcedureViewModel>(
|
||||
onModelReady: (model) async {
|
||||
if (model.procedureTemplate.length == 0) {
|
||||
model.getProcedureTemplate();
|
||||
}
|
||||
},
|
||||
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
||||
AppScaffold(
|
||||
isShowAppBar: false,
|
||||
body: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height * 0.070,
|
||||
),
|
||||
if (model.procedureTemplate.length != 0)
|
||||
Expanded(
|
||||
child: NetworkBaseView(
|
||||
baseViewModel: model,
|
||||
child:
|
||||
// selectedCategory != null
|
||||
// ? selectedCategory['categoryId'] == 02 ||
|
||||
// selectedCategory['categoryId'] == 03
|
||||
// ?
|
||||
EntityListCheckboxSearchFavProceduresWidget(
|
||||
model: widget.model,
|
||||
masterList: widget.model.procedureTemplate,
|
||||
removeFavProcedure: (item) {
|
||||
setState(() {
|
||||
entityList.remove(item);
|
||||
});
|
||||
},
|
||||
addFavProcedure: (history) {
|
||||
setState(() {
|
||||
entityList.add(history);
|
||||
});
|
||||
},
|
||||
addSelectedHistories: () {
|
||||
//TODO build your fun herr
|
||||
// widget.addSelectedHistories();
|
||||
},
|
||||
isEntityFavListSelected: (master) =>
|
||||
isEntityListSelected(master),
|
||||
)
|
||||
// : ProcedureListWidget(
|
||||
// model: widget.model,
|
||||
// masterList: widget.model
|
||||
// .categoriesList[0].entityList,
|
||||
// removeHistory: (item) {
|
||||
// setState(() {
|
||||
// entityList.remove(item);
|
||||
// });
|
||||
// },
|
||||
// addHistory: (history) {
|
||||
// setState(() {
|
||||
// entityList.add(history);
|
||||
// });
|
||||
// },
|
||||
// addSelectedHistories: () {
|
||||
// //TODO build your fun herr
|
||||
// // widget.addSelectedHistories();
|
||||
// },
|
||||
// isEntityListSelected: (master) =>
|
||||
// isEntityListSelected(master),
|
||||
// )
|
||||
// : null,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
||||
child: Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
children: <Widget>[
|
||||
AppButton(
|
||||
title: TranslationBase.of(context).addSelectedProcedures,
|
||||
color: Color(0xff359846),
|
||||
fontWeight: FontWeight.w700,
|
||||
onPressed: () {
|
||||
//print(entityList.toString());
|
||||
onPressed:
|
||||
if (entityList.isEmpty == true) {
|
||||
DrAppToastMsg.showErrorToast(
|
||||
TranslationBase.of(context)
|
||||
.fillTheMandatoryProcedureDetails,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
Navigator.pop(context);
|
||||
// postProcedure(
|
||||
// orderType: selectedType.toString(),
|
||||
// entityList: entityList,
|
||||
// patient: patient,
|
||||
// model: widget.model,
|
||||
// remarks: remarksController.text);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
bool isEntityListSelected(ProcedureTempleteDetailsModel masterKey) {
|
||||
Iterable<ProcedureTempleteDetailsModel> history = entityList
|
||||
.where((element) => masterKey.templateID == element.templateID);
|
||||
if (history.length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,216 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/screens/procedures/add-favourite-procedure.dart';
|
||||
import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.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/network_base_view.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AddProcedureHome extends StatefulWidget {
|
||||
final ProcedureViewModel model;
|
||||
final PatiantInformtion patient;
|
||||
const AddProcedureHome({Key key, this.model, this.patient}) : super(key: key);
|
||||
@override
|
||||
_AddProcedureHomeState createState() =>
|
||||
_AddProcedureHomeState(patient: patient, model: model);
|
||||
}
|
||||
|
||||
class _AddProcedureHomeState extends State<AddProcedureHome>
|
||||
with SingleTickerProviderStateMixin {
|
||||
_AddProcedureHomeState({this.patient, this.model});
|
||||
ProcedureViewModel model;
|
||||
PatiantInformtion patient;
|
||||
TabController _tabController;
|
||||
int _activeTab = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_tabController = TabController(length: 2, vsync: this);
|
||||
_tabController.addListener(_handleTabSelection);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
_tabController.dispose();
|
||||
}
|
||||
|
||||
_handleTabSelection() {
|
||||
setState(() {
|
||||
_activeTab = _tabController.index;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
//final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
||||
//PatiantInformtion patient = routeArgs['patient'];
|
||||
final screenSize = MediaQuery.of(context).size;
|
||||
return BaseView<ProcedureViewModel>(
|
||||
//onModelReady: (model) => model.getCategory(),
|
||||
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
||||
AppScaffold(
|
||||
isShowAppBar: false,
|
||||
body: NetworkBaseView(
|
||||
baseViewModel: model,
|
||||
child: DraggableScrollableSheet(
|
||||
minChildSize: 0.90,
|
||||
initialChildSize: 0.95,
|
||||
maxChildSize: 1.0,
|
||||
builder:
|
||||
(BuildContext context, ScrollController scrollController) {
|
||||
return Container(
|
||||
height: MediaQuery.of(context).size.height * 1.20,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
AppText(
|
||||
'Add Procedure',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 20,
|
||||
),
|
||||
InkWell(
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
size: 24.0,
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
)
|
||||
]),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.04,
|
||||
),
|
||||
Expanded(
|
||||
child: Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: PreferredSize(
|
||||
preferredSize: Size.fromHeight(
|
||||
MediaQuery.of(context).size.height * 0.070),
|
||||
child: Container(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * 0.070,
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: Theme.of(context).dividerColor,
|
||||
width: 0.5), //width: 0.7
|
||||
),
|
||||
color: Colors.white),
|
||||
child: Center(
|
||||
child: TabBar(
|
||||
isScrollable: false,
|
||||
controller: _tabController,
|
||||
indicatorColor: Colors.transparent,
|
||||
indicatorWeight: 1.0,
|
||||
indicatorSize: TabBarIndicatorSize.tab,
|
||||
labelColor: Theme.of(context).primaryColor,
|
||||
labelPadding: EdgeInsets.only(
|
||||
top: 0, left: 0, right: 0, bottom: 0),
|
||||
unselectedLabelColor: Colors.grey[800],
|
||||
tabs: [
|
||||
tabWidget(
|
||||
screenSize,
|
||||
_activeTab == 0,
|
||||
'All Procedures',
|
||||
),
|
||||
tabWidget(
|
||||
screenSize,
|
||||
_activeTab == 1,
|
||||
"Favorite Templates",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
physics: BouncingScrollPhysics(),
|
||||
controller: _tabController,
|
||||
children: [
|
||||
AddSelectedProcedure(
|
||||
model: model,
|
||||
patient: patient,
|
||||
),
|
||||
AddFavouriteProcedure(
|
||||
patient: patient,
|
||||
model: model,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget tabWidget(Size screenSize, bool isActive, String title,
|
||||
{int counter = -1}) {
|
||||
return Center(
|
||||
child: Container(
|
||||
height: screenSize.height * 0.070,
|
||||
decoration: TextFieldsUtils.containerBorderDecoration(
|
||||
isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA),
|
||||
isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA),
|
||||
borderRadius: 4,
|
||||
borderWidth: 0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
AppText(
|
||||
title,
|
||||
fontSize: SizeConfig.textMultiplier * 1.5,
|
||||
color: isActive ? Colors.white : Color(0xFF2B353E),
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
if (counter != -1)
|
||||
Container(
|
||||
margin: EdgeInsets.all(4),
|
||||
width: 15,
|
||||
height: 15,
|
||||
decoration: BoxDecoration(
|
||||
color: isActive ? Colors.white : Color(0xFFD02127),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Center(
|
||||
child: FittedBox(
|
||||
child: AppText(
|
||||
"$counter",
|
||||
fontSize: SizeConfig.textMultiplier * 1.5,
|
||||
color: !isActive ? Colors.white : Color(0xFFD02127),
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,256 @@
|
||||
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
|
||||
import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart';
|
||||
import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget {
|
||||
final ProcedureViewModel model;
|
||||
final Function addSelectedHistories;
|
||||
final Function(ProcedureTempleteModel) removeHistory;
|
||||
final Function(ProcedureTempleteModel) addHistory;
|
||||
final Function(ProcedureTempleteModel) addRemarks;
|
||||
|
||||
final Function(ProcedureTempleteDetailsModel) removeFavProcedure;
|
||||
final Function(ProcedureTempleteDetailsModel) addFavProcedure;
|
||||
final Function(ProcedureTempleteDetailsModel) addProceduresRemarks;
|
||||
|
||||
final bool Function(ProcedureTempleteModel) isEntityListSelected;
|
||||
final bool Function(ProcedureTempleteDetailsModel) isEntityFavListSelected;
|
||||
final List<ProcedureTempleteModel> masterList;
|
||||
|
||||
EntityListCheckboxSearchFavProceduresWidget(
|
||||
{Key key,
|
||||
this.model,
|
||||
this.addSelectedHistories,
|
||||
this.removeHistory,
|
||||
this.masterList,
|
||||
this.addHistory,
|
||||
this.addFavProcedure,
|
||||
this.addProceduresRemarks,
|
||||
this.removeFavProcedure,
|
||||
this.isEntityListSelected,
|
||||
this.isEntityFavListSelected,
|
||||
this.addRemarks})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_EntityListCheckboxSearchFavProceduresWidgetState createState() =>
|
||||
_EntityListCheckboxSearchFavProceduresWidgetState();
|
||||
}
|
||||
|
||||
class _EntityListCheckboxSearchFavProceduresWidgetState
|
||||
extends State<EntityListCheckboxSearchFavProceduresWidget> {
|
||||
int selectedType = 0;
|
||||
int typeUrgent;
|
||||
int typeRegular;
|
||||
|
||||
setSelectedType(int val) {
|
||||
setState(() {
|
||||
selectedType = val;
|
||||
});
|
||||
}
|
||||
|
||||
List<ProcedureTempleteModel> items = List();
|
||||
List<ProcedureTempleteDetailsModel> itemsProcedure = List();
|
||||
List<String> remarksList = List();
|
||||
List<int> typeList = List();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
items.addAll(widget.masterList);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
TextEditingController remarksController = TextEditingController();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
child: Column(
|
||||
children: [
|
||||
NetworkBaseView(
|
||||
baseViewModel: widget.model,
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.height * 0.65,
|
||||
child: Center(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 15),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Colors.white),
|
||||
child: ListView(
|
||||
children: [
|
||||
TextFields(
|
||||
hintText: 'Search Favourite templates',
|
||||
suffixIcon: EvaIcons.search,
|
||||
suffixIconColor: Color(0xff2B353E),
|
||||
onChanged: (value) {
|
||||
filterSearchResults(value);
|
||||
},
|
||||
hasBorder: false,
|
||||
),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
items.length != 0
|
||||
? Column(
|
||||
children: items.map((historyInfo) {
|
||||
return Column(
|
||||
children: [
|
||||
ExpansionTile(
|
||||
title: InkWell(
|
||||
onTap: () {
|
||||
widget.model
|
||||
.getProcedureTemplateDetails(
|
||||
templateId:
|
||||
historyInfo.templateID);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.folder,
|
||||
size: 20,
|
||||
color: Color(0xff575757),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 0),
|
||||
child: AppText(
|
||||
"Procedures for " +
|
||||
historyInfo.templateName,
|
||||
fontSize: 16.0,
|
||||
variant: "bodyText",
|
||||
bold: true,
|
||||
color: Color(0xff575757)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
children: [
|
||||
Column(
|
||||
children: widget
|
||||
.model.procedureTemplateDetails
|
||||
.map((itemProcedure) {
|
||||
return Container(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets
|
||||
.symmetric(
|
||||
horizontal: 11),
|
||||
child: Checkbox(
|
||||
value: widget
|
||||
.isEntityFavListSelected(
|
||||
itemProcedure),
|
||||
activeColor: Color(
|
||||
0xffD02127),
|
||||
onChanged: (bool
|
||||
newValue) {
|
||||
setState(() {
|
||||
if (widget
|
||||
.isEntityFavListSelected(
|
||||
itemProcedure)) {
|
||||
widget.removeFavProcedure(
|
||||
itemProcedure);
|
||||
} else {
|
||||
widget.addFavProcedure(
|
||||
itemProcedure);
|
||||
}
|
||||
});
|
||||
}),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets
|
||||
.symmetric(
|
||||
horizontal:
|
||||
10,
|
||||
vertical: 0),
|
||||
child: AppText(
|
||||
itemProcedure
|
||||
.procedureName,
|
||||
fontSize: 14.0,
|
||||
variant:
|
||||
"bodyText",
|
||||
bold: true,
|
||||
color: Color(
|
||||
0xff575757)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
SizedBox(
|
||||
height: 2.0,
|
||||
),
|
||||
DividerWithSpacesAround(),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}).toList(),
|
||||
)
|
||||
: Center(
|
||||
child: Container(
|
||||
child: AppText("Sorry , No Match",
|
||||
color: Color(0xFFB9382C)),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void filterSearchResults(String query) {
|
||||
List<ProcedureTempleteModel> dummySearchList = List();
|
||||
dummySearchList.addAll(widget.masterList);
|
||||
if (query.isNotEmpty) {
|
||||
List<ProcedureTempleteModel> dummyListData = List();
|
||||
dummySearchList.forEach((item) {
|
||||
if (item.templateName.toLowerCase().contains(query.toLowerCase())) {
|
||||
dummyListData.add(item);
|
||||
}
|
||||
});
|
||||
setState(() {
|
||||
items.clear();
|
||||
items.addAll(dummyListData);
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
setState(() {
|
||||
items.clear();
|
||||
items.addAll(widget.masterList);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,174 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
||||
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:html_editor_enhanced/html_editor.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:speech_to_text/speech_recognition_error.dart';
|
||||
import 'package:speech_to_text/speech_to_text.dart' as stt;
|
||||
import '../speech-text-popup.dart';
|
||||
|
||||
class HtmlRichEditor extends StatefulWidget {
|
||||
HtmlRichEditor({
|
||||
key,
|
||||
this.hint = "Your text here...",
|
||||
this.initialText,
|
||||
this.height = 400,
|
||||
this.decoration,
|
||||
this.darkMode = false,
|
||||
this.showBottomToolbar = false,
|
||||
this.toolbar,
|
||||
}) : super(key: key);
|
||||
final String hint;
|
||||
final String initialText;
|
||||
final double height;
|
||||
final BoxDecoration decoration;
|
||||
final bool darkMode;
|
||||
final bool showBottomToolbar;
|
||||
final List<Toolbar> toolbar;
|
||||
|
||||
|
||||
@override
|
||||
_HtmlRichEditorState createState() => _HtmlRichEditorState();
|
||||
}
|
||||
|
||||
class _HtmlRichEditorState extends State<HtmlRichEditor> {
|
||||
ProjectViewModel projectViewModel;
|
||||
stt.SpeechToText speech = stt.SpeechToText();
|
||||
var recognizedWord;
|
||||
var event = RobotProvider();
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
requestPermissions();
|
||||
event.controller.stream.listen((p) {
|
||||
if (p['startPopUp'] == 'true') {
|
||||
if (this.mounted) {
|
||||
initSpeechState().then((value) => {onVoiceText()});
|
||||
}
|
||||
}
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
projectViewModel = Provider.of(context);
|
||||
|
||||
return Stack(
|
||||
children: [
|
||||
HtmlEditor(
|
||||
hint: widget.hint,
|
||||
height: widget.height,
|
||||
initialText: widget.initialText,
|
||||
showBottomToolbar: widget.showBottomToolbar,
|
||||
darkMode: widget.darkMode,
|
||||
decoration: widget.decoration ??
|
||||
BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(30.0),
|
||||
),
|
||||
border: Border.all(color: Colors.grey[200], width: 0.5),
|
||||
),
|
||||
toolbar: widget.toolbar ??
|
||||
const [
|
||||
// Style(),
|
||||
Font(buttons: [
|
||||
FontButtons.bold,
|
||||
FontButtons.underline,
|
||||
FontButtons.clear
|
||||
]),
|
||||
// ColorBar(buttons: [ColorButtons.color]),
|
||||
Paragraph(buttons: [
|
||||
ParagraphButtons.ul,
|
||||
ParagraphButtons.ol,
|
||||
ParagraphButtons.paragraph
|
||||
]),
|
||||
// Insert(buttons: [InsertButtons.link, InsertButtons.picture, InsertButtons.video, InsertButtons.table]),
|
||||
// Misc(buttons: [MiscButtons.fullscreen, MiscButtons.codeview, MiscButtons.help])
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
top:
|
||||
50, //MediaQuery.of(context).size.height * 0,
|
||||
right: projectViewModel.isArabic
|
||||
? MediaQuery.of(context).size.width * 0.75
|
||||
: 15,
|
||||
child: Column(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: Icon(DoctorApp.speechtotext,
|
||||
color: Colors.black, size: 35),
|
||||
onPressed: () {
|
||||
initSpeechState()
|
||||
.then((value) => {onVoiceText()});
|
||||
},
|
||||
),
|
||||
],
|
||||
))
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
onVoiceText() async {
|
||||
new SpeechToText(context: context).showAlertDialog(context);
|
||||
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
|
||||
bool available = await speech.initialize(
|
||||
onStatus: statusListener, onError: errorListener);
|
||||
if (available) {
|
||||
speech.listen(
|
||||
onResult: resultListener,
|
||||
listenMode: stt.ListenMode.confirmation,
|
||||
localeId: lang == 'en' ? 'en-US' : 'ar-SA',
|
||||
);
|
||||
} else {
|
||||
print("The user has denied the use of speech recognition.");
|
||||
}
|
||||
}
|
||||
|
||||
void errorListener(SpeechRecognitionError error) {
|
||||
event.setValue({"searchText": 'null'});
|
||||
//SpeechToText.closeAlertDialog(context);
|
||||
print(error);
|
||||
}
|
||||
|
||||
void statusListener(String status) {
|
||||
recognizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
|
||||
}
|
||||
|
||||
void requestPermissions() async {
|
||||
Map<Permission, PermissionStatus> statuses = await [
|
||||
Permission.microphone,
|
||||
].request();
|
||||
}
|
||||
|
||||
void resultListener(result)async {
|
||||
recognizedWord = result.recognizedWords;
|
||||
event.setValue({"searchText": recognizedWord});
|
||||
String txt = await HtmlEditor.getText();
|
||||
if (result.finalResult == true) {
|
||||
setState(() {
|
||||
SpeechToText.closeAlertDialog(context);
|
||||
speech.stop();
|
||||
HtmlEditor.setText(txt+recognizedWord);
|
||||
});
|
||||
} else {
|
||||
print(result.finalResult);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> initSpeechState() async {
|
||||
bool hasSpeech = await speech.initialize(
|
||||
onError: errorListener, onStatus: statusListener);
|
||||
print(hasSpeech);
|
||||
if (!mounted) return;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue