use new date and time in Doc Gen
This commit is contained in:
@@ -1,62 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import '../mih_components/mih_inputs_and_buttons/mih_date_input.dart';
|
|
||||||
|
|
||||||
class Medcertinput extends StatefulWidget {
|
|
||||||
final TextEditingController startDateController;
|
|
||||||
final TextEditingController endDateTextController;
|
|
||||||
final TextEditingController retDateTextController;
|
|
||||||
const Medcertinput({
|
|
||||||
super.key,
|
|
||||||
required this.startDateController,
|
|
||||||
required this.endDateTextController,
|
|
||||||
required this.retDateTextController,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<Medcertinput> createState() => _MedcertinputState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MedcertinputState extends State<Medcertinput> {
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return SizedBox(
|
|
||||||
//height: 325,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
//const SizedBox(height: 50.0),
|
|
||||||
SizedBox(
|
|
||||||
width: 700,
|
|
||||||
child: MIHDateField(
|
|
||||||
controller: widget.startDateController,
|
|
||||||
lableText: "From",
|
|
||||||
required: true,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10.0),
|
|
||||||
SizedBox(
|
|
||||||
width: 700,
|
|
||||||
child: MIHDateField(
|
|
||||||
controller: widget.endDateTextController,
|
|
||||||
lableText: "Up to Including",
|
|
||||||
required: true,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10.0),
|
|
||||||
SizedBox(
|
|
||||||
width: 700,
|
|
||||||
child: MIHDateField(
|
|
||||||
controller: widget.retDateTextController,
|
|
||||||
lableText: "Return",
|
|
||||||
required: true,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,152 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import '../../main.dart';
|
|
||||||
|
|
||||||
class MIHDateField extends StatefulWidget {
|
|
||||||
final TextEditingController controller;
|
|
||||||
final String lableText;
|
|
||||||
final bool required;
|
|
||||||
|
|
||||||
const MIHDateField({
|
|
||||||
super.key,
|
|
||||||
required this.controller,
|
|
||||||
required this.lableText,
|
|
||||||
required this.required,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<MIHDateField> createState() => _MIHDateFieldState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MIHDateFieldState extends State<MIHDateField> {
|
|
||||||
final FocusNode _focus = FocusNode();
|
|
||||||
bool startup = true;
|
|
||||||
// bool makeEditable() {
|
|
||||||
Future<void> _selectDate(BuildContext context) async {
|
|
||||||
DateTime? picked = await showDatePicker(
|
|
||||||
context: context,
|
|
||||||
initialDate: DateTime.now(),
|
|
||||||
firstDate: DateTime(2000),
|
|
||||||
lastDate: DateTime(2100),
|
|
||||||
);
|
|
||||||
if (picked != null) {
|
|
||||||
setState(() {
|
|
||||||
widget.controller.text = picked.toString().split(" ")[0];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget setRequiredText() {
|
|
||||||
if (widget.required) {
|
|
||||||
return Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"*",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.errorColor()),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 8.0,
|
|
||||||
),
|
|
||||||
Text(widget.lableText,
|
|
||||||
style: TextStyle(
|
|
||||||
color:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor())),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return Text(widget.lableText,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onFocusChange() {
|
|
||||||
setState(() {
|
|
||||||
startup = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
String? get _errorText {
|
|
||||||
final text = widget.controller.text;
|
|
||||||
if (startup) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!widget.required) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (text.isEmpty) {
|
|
||||||
return "${widget.lableText} is required";
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_focus.dispose();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
_focus.addListener(_onFocusChange);
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return TextField(
|
|
||||||
style: TextStyle(
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
|
|
||||||
controller: widget.controller,
|
|
||||||
readOnly: true,
|
|
||||||
obscureText: false,
|
|
||||||
focusNode: _focus,
|
|
||||||
onChanged: (_) => setState(() {
|
|
||||||
startup = false;
|
|
||||||
}),
|
|
||||||
decoration: InputDecoration(
|
|
||||||
errorText: _errorText,
|
|
||||||
errorStyle: TextStyle(
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
label: setRequiredText(),
|
|
||||||
//labelText: widget.lableText,
|
|
||||||
//labelStyle: const TextStyle(color: Colors.blueAccent),
|
|
||||||
prefixIcon: Icon(
|
|
||||||
Icons.calendar_today,
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
),
|
|
||||||
fillColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
filled: true,
|
|
||||||
//hintText: hintText,
|
|
||||||
//hintStyle: TextStyle(color: Colors.blueGrey[400]),
|
|
||||||
enabledBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
width: 2.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
focusedErrorBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
|
||||||
width: 2.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
errorBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
|
||||||
width: 2.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
_selectDate(context);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,8 +3,8 @@ import 'package:mzansi_innovation_hub/mih_apis/mih_alert_services.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_apis/mih_claim_statement_generation_api.dart';
|
import 'package:mzansi_innovation_hub/mih_apis/mih_claim_statement_generation_api.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_apis/mih_icd10_code_api.dart';
|
import 'package:mzansi_innovation_hub/mih_apis/mih_icd10_code_api.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_apis/mih_validation_services.dart';
|
import 'package:mzansi_innovation_hub/mih_apis/mih_validation_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_date_input.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_button.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_date_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_form.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_form.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_radio_options.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_radio_options.dart';
|
||||||
@@ -118,11 +118,19 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
|
|||||||
color:
|
color:
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor()),
|
MzanziInnovationHub.of(context)!.theme.secondaryColor()),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
MIHDateField(
|
MihDateField(
|
||||||
controller: _serviceDateController,
|
controller: _serviceDateController,
|
||||||
lableText: "Date of Service",
|
labelText: "Date of Service",
|
||||||
required: true,
|
required: true,
|
||||||
|
validator: (value) {
|
||||||
|
return MihValidationServices().isEmpty(value);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
|
// MIHDateField(
|
||||||
|
// controller: _serviceDateController,
|
||||||
|
// lableText: "Date of Service",
|
||||||
|
// required: true,
|
||||||
|
// ),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
MihRadioOptions(
|
MihRadioOptions(
|
||||||
controller: _serviceDescController,
|
controller: _serviceDescController,
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import 'package:mzansi_innovation_hub/main.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_apis/mih_alert_services.dart';
|
import 'package:mzansi_innovation_hub/mih_apis/mih_alert_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_apis/mih_file_api.dart';
|
import 'package:mzansi_innovation_hub/mih_apis/mih_file_api.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_apis/mih_validation_services.dart';
|
import 'package:mzansi_innovation_hub/mih_apis/mih_validation_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/med_cert_input.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_single_child_scroll.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_single_child_scroll.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_button.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_date_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_form.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_form.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tool_body.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tool_body.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_floating_menu.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_floating_menu.dart';
|
||||||
@@ -64,6 +64,7 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
final outputController = TextEditingController();
|
final outputController = TextEditingController();
|
||||||
late PlatformFile? selected;
|
late PlatformFile? selected;
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
final _formKey2 = GlobalKey<FormState>();
|
||||||
late String env;
|
late String env;
|
||||||
|
|
||||||
Future<void> submitDocUploadForm() async {
|
Future<void> submitDocUploadForm() async {
|
||||||
@@ -296,7 +297,7 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 20),
|
||||||
MihButton(
|
MihButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
@@ -342,37 +343,67 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
},
|
},
|
||||||
windowBody: Column(
|
windowBody: Column(
|
||||||
children: [
|
children: [
|
||||||
Medcertinput(
|
MihForm(
|
||||||
startDateController: startDateController,
|
formKey: _formKey2,
|
||||||
endDateTextController: endDateTextController,
|
formFields: [
|
||||||
retDateTextController: retDateTextController,
|
MihDateField(
|
||||||
),
|
controller: startDateController,
|
||||||
const SizedBox(height: 15.0),
|
labelText: "From",
|
||||||
MihButton(
|
required: true,
|
||||||
onPressed: () async {
|
validator: (value) {
|
||||||
if (isMedCertFieldsFilled()) {
|
return MihValidationServices().isEmpty(value);
|
||||||
await generateMedCert();
|
},
|
||||||
//Navigator.pop(context);
|
|
||||||
} else {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return const MIHErrorMessage(errorType: "Input Error");
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
buttonColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Generate",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 10.0),
|
||||||
|
MihDateField(
|
||||||
|
controller: endDateTextController,
|
||||||
|
labelText: "Up to Including",
|
||||||
|
required: true,
|
||||||
|
validator: (value) {
|
||||||
|
return MihValidationServices().isEmpty(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10.0),
|
||||||
|
MihDateField(
|
||||||
|
controller: retDateTextController,
|
||||||
|
labelText: "Return",
|
||||||
|
required: true,
|
||||||
|
validator: (value) {
|
||||||
|
return MihValidationServices().isEmpty(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
// Medcertinput(
|
||||||
|
// startDateController: startDateController,
|
||||||
|
// endDateTextController: endDateTextController,
|
||||||
|
// retDateTextController: retDateTextController,
|
||||||
|
// ),
|
||||||
|
const SizedBox(height: 15.0),
|
||||||
|
Center(
|
||||||
|
child: MihButton(
|
||||||
|
onPressed: () async {
|
||||||
|
if (_formKey2.currentState!.validate()) {
|
||||||
|
await generateMedCert();
|
||||||
|
//Navigator.pop(context);
|
||||||
|
} else {
|
||||||
|
MihAlertServices().formNotFilledCompletely(context);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
buttonColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Generate",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.primaryColor(),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user