|
|
@ -28,24 +28,10 @@ class PentryTBSForm extends StatefulWidget {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
Ppm _model;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
void initState() {
|
|
|
|
|
|
|
|
_model = widget.model;
|
|
|
|
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
void dispose() {
|
|
|
|
|
|
|
|
print("disposeddddddd");
|
|
|
|
|
|
|
|
super.dispose();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
_model?.files ??= [];
|
|
|
|
widget.model?.files ??= [];
|
|
|
|
_model?.files = (_model.files ?? []).where((element) => element.attachmentName != null && element.attachmentName.isNotEmpty).toList();
|
|
|
|
widget.model?.files = (widget.model.files ?? []).where((element) => element.attachmentName != null && element.attachmentName.isNotEmpty).toList();
|
|
|
|
|
|
|
|
|
|
|
|
return SingleChildScrollView(
|
|
|
|
return SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
@ -54,7 +40,7 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|
SingleItemDropDownMenu<Lookup, PPMVisitStatusProvider>(
|
|
|
|
SingleItemDropDownMenu<Lookup, PPMVisitStatusProvider>(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
initialValue: _model.visitStatusId == null ? null : Lookup(name: _model.visitStatusName ?? "", id: _model.visitStatusId),
|
|
|
|
initialValue: widget.model.visitStatusId == null ? null : Lookup(name: widget.model.visitStatusName ?? "", id: widget.model.visitStatusId),
|
|
|
|
title: context.translation.ppmVisit,
|
|
|
|
title: context.translation.ppmVisit,
|
|
|
|
onSelect: (value) {
|
|
|
|
onSelect: (value) {
|
|
|
|
if (value?.value == 4) {
|
|
|
|
if (value?.value == 4) {
|
|
|
@ -64,93 +50,96 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (value != null) {
|
|
|
|
if (value != null) {
|
|
|
|
_model.visitStatusName = value.name;
|
|
|
|
widget.model.visitStatusName = value.name;
|
|
|
|
_model.visitStatusId = value.id;
|
|
|
|
widget.model.visitStatusId = value.id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|
AppTimer(
|
|
|
|
AppTimer(
|
|
|
|
label: context.translation.timer,
|
|
|
|
label: context.translation.timer,
|
|
|
|
timer: _model.tbsTimer,
|
|
|
|
timer: widget.model.tbsTimer,
|
|
|
|
enabled: _model.tbsTimer.endAt == null,
|
|
|
|
enabled: widget.model.tbsTimer.endAt == null,
|
|
|
|
|
|
|
|
timerProgress: (isRunning) {
|
|
|
|
|
|
|
|
print("timerProgress:$isRunning");
|
|
|
|
|
|
|
|
},
|
|
|
|
onChange: (timer) async {
|
|
|
|
onChange: (timer) async {
|
|
|
|
_model.tbsTimer = timer;
|
|
|
|
widget.model.tbsTimer = timer;
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|
SingleItemDropDownMenu<Lookup, PPMDeviceStatusProvider>(
|
|
|
|
SingleItemDropDownMenu<Lookup, PPMDeviceStatusProvider>(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
initialValue: _model.deviceStatusId == null ? null : Lookup(name: _model.deviceStatusName ?? "", id: _model.deviceStatusId),
|
|
|
|
initialValue: widget.model.deviceStatusId == null ? null : Lookup(name: widget.model.deviceStatusName ?? "", id: widget.model.deviceStatusId),
|
|
|
|
title: context.translation.deviceStatus,
|
|
|
|
title: context.translation.deviceStatus,
|
|
|
|
onSelect: (value) {
|
|
|
|
onSelect: (value) {
|
|
|
|
if (value != null) {
|
|
|
|
if (value != null) {
|
|
|
|
_model.deviceStatusId = value.id;
|
|
|
|
widget.model.deviceStatusId = value.id;
|
|
|
|
_model.deviceStatusName = value.name;
|
|
|
|
widget.model.deviceStatusName = value.name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|
ADatePicker(
|
|
|
|
ADatePicker(
|
|
|
|
label: context.translation.actualVisitDate,
|
|
|
|
label: context.translation.actualVisitDate,
|
|
|
|
date: DateTime.tryParse(_model.actualDate ?? ""),
|
|
|
|
date: DateTime.tryParse(widget.model.actualDate ?? ""),
|
|
|
|
from: DateTime.now().subtract(const Duration(days: 30)),
|
|
|
|
from: DateTime.now().subtract(const Duration(days: 30)),
|
|
|
|
onDatePicker: (date) {
|
|
|
|
onDatePicker: (date) {
|
|
|
|
if (date == null) return;
|
|
|
|
if (date == null) return;
|
|
|
|
_model.actualDate = date?.toIso8601String();
|
|
|
|
widget.model.actualDate = date?.toIso8601String();
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|
ADatePicker(
|
|
|
|
ADatePicker(
|
|
|
|
label: context.translation.expectedVisitDate,
|
|
|
|
label: context.translation.expectedVisitDate,
|
|
|
|
date: DateTime.tryParse(_model.expectedDate ?? ""),
|
|
|
|
date: DateTime.tryParse(widget.model.expectedDate ?? ""),
|
|
|
|
from: DateTime.now().subtract(const Duration(days: 30)),
|
|
|
|
from: DateTime.now().subtract(const Duration(days: 30)),
|
|
|
|
enable: false,
|
|
|
|
enable: false,
|
|
|
|
onDatePicker: (date) {
|
|
|
|
onDatePicker: (date) {
|
|
|
|
if (date == null) return;
|
|
|
|
if (date == null) return;
|
|
|
|
_model.expectedDate = date?.toIso8601String();
|
|
|
|
widget.model.expectedDate = date?.toIso8601String();
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|
AppTextFormField(
|
|
|
|
AppTextFormField(
|
|
|
|
labelText: context.translation.travelingHours,
|
|
|
|
labelText: context.translation.travelingHours,
|
|
|
|
initialValue: (_model.travelingHours ?? "").toString(),
|
|
|
|
initialValue: (widget.model.travelingHours ?? "").toString(),
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
onChange: (value) {
|
|
|
|
onChange: (value) {
|
|
|
|
_model.travelingHours = value;
|
|
|
|
widget.model.travelingHours = value;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|
MultiFilesPicker(
|
|
|
|
MultiFilesPicker(
|
|
|
|
label: context.translation.attachImage,
|
|
|
|
label: context.translation.attachImage,
|
|
|
|
files: _model.files.map((e) => File(e.attachmentName)).toList(),
|
|
|
|
files: widget.model.files.map((e) => File(e.attachmentName)).toList(),
|
|
|
|
onChange: (files) {
|
|
|
|
onChange: (files) {
|
|
|
|
_model.files = files.map((e) => PpmAttachments(attachmentName: e.path)).toList();
|
|
|
|
widget.model.files = files.map((e) => PpmAttachments(attachmentName: e.path)).toList();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|
ESignature(
|
|
|
|
ESignature(
|
|
|
|
title: context.translation.nurseSignature,
|
|
|
|
title: context.translation.nurseSignature,
|
|
|
|
oldSignature: _model.nurseSignature,
|
|
|
|
oldSignature: widget.model.nurseSignature,
|
|
|
|
newSignature: _model.localNurseSignature,
|
|
|
|
newSignature: widget.model.localNurseSignature,
|
|
|
|
onChange: (signature) {
|
|
|
|
onChange: (signature) {
|
|
|
|
_model.localNurseSignature = signature;
|
|
|
|
widget.model.localNurseSignature = signature;
|
|
|
|
_model.nurseSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
widget.model.nurseSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|
ESignature(
|
|
|
|
ESignature(
|
|
|
|
title: context.translation.engSign,
|
|
|
|
title: context.translation.engSign,
|
|
|
|
oldSignature: _model.engSignature,
|
|
|
|
oldSignature: widget.model.engSignature,
|
|
|
|
newSignature: _model.localEngineerSignature,
|
|
|
|
newSignature: widget.model.localEngineerSignature,
|
|
|
|
onChange: (signature) {
|
|
|
|
onChange: (signature) {
|
|
|
|
_model.localEngineerSignature = signature;
|
|
|
|
widget.model.localEngineerSignature = signature;
|
|
|
|
_model.engSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
widget.model.engSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|