|
|
|
|
@ -41,10 +41,7 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
widget.model?.files ??= [];
|
|
|
|
|
widget.model?.files = (widget.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(
|
|
|
|
|
child: Column(
|
|
|
|
|
@ -53,17 +50,11 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
|
8.height,
|
|
|
|
|
SingleItemDropDownMenu<Lookup, PPMVisitStatusProvider>(
|
|
|
|
|
context: context,
|
|
|
|
|
initialValue: widget.model.visitStatusId == null
|
|
|
|
|
? null
|
|
|
|
|
: Lookup(
|
|
|
|
|
name: widget.model.visitStatusName ?? "",
|
|
|
|
|
id: widget.model.visitStatusId),
|
|
|
|
|
initialValue: widget.model.visitStatusId == null ? null : Lookup(name: widget.model.visitStatusName ?? "", id: widget.model.visitStatusId),
|
|
|
|
|
title: context.translation.ppmVisit,
|
|
|
|
|
onSelect: (value) {
|
|
|
|
|
if (value?.value == 4) {
|
|
|
|
|
"Status cannot be change to ${value.name}."
|
|
|
|
|
.addTranslation
|
|
|
|
|
.showToast;
|
|
|
|
|
"Status cannot be change to ${value.name}.".addTranslation.showToast;
|
|
|
|
|
setState(() {});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@ -90,11 +81,7 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
|
8.height,
|
|
|
|
|
SingleItemDropDownMenu<Lookup, PPMDeviceStatusProvider>(
|
|
|
|
|
context: context,
|
|
|
|
|
initialValue: widget.model.deviceStatusId == null
|
|
|
|
|
? null
|
|
|
|
|
: Lookup(
|
|
|
|
|
name: widget.model.deviceStatusName ?? "",
|
|
|
|
|
id: widget.model.deviceStatusId),
|
|
|
|
|
initialValue: widget.model.deviceStatusId == null ? null : Lookup(name: widget.model.deviceStatusName ?? "", id: widget.model.deviceStatusId),
|
|
|
|
|
title: context.translation.deviceStatus,
|
|
|
|
|
onSelect: (value) {
|
|
|
|
|
if (value != null) {
|
|
|
|
|
@ -106,11 +93,7 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
|
8.height,
|
|
|
|
|
SingleItemDropDownMenu<Lookup, PpmTaskStatusProvider>(
|
|
|
|
|
context: context,
|
|
|
|
|
initialValue: widget.model.taskStatusId == null
|
|
|
|
|
? null
|
|
|
|
|
: Lookup(
|
|
|
|
|
name: widget.model.taskStatusName ?? "",
|
|
|
|
|
id: widget.model.taskStatusId),
|
|
|
|
|
initialValue: widget.model.taskStatusId == null ? null : Lookup(name: widget.model.taskStatusName ?? "", id: widget.model.taskStatusId),
|
|
|
|
|
title: context.translation.taskStatus,
|
|
|
|
|
onSelect: (value) {
|
|
|
|
|
if (value != null) {
|
|
|
|
|
@ -122,11 +105,7 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
|
8.height,
|
|
|
|
|
SingleItemDropDownMenu<Lookup, PpmAssetAvailabilityProvider>(
|
|
|
|
|
context: context,
|
|
|
|
|
initialValue: widget.model.assetAvailabilityId == null
|
|
|
|
|
? null
|
|
|
|
|
: Lookup(
|
|
|
|
|
name: widget.model.assetAvailabilityName ?? "",
|
|
|
|
|
id: widget.model.assetAvailabilityId),
|
|
|
|
|
initialValue: widget.model.assetAvailabilityId == null ? null : Lookup(name: widget.model.assetAvailabilityName ?? "", id: widget.model.assetAvailabilityId),
|
|
|
|
|
title: "Asset Availability",
|
|
|
|
|
onSelect: (value) {
|
|
|
|
|
if (value != null) {
|
|
|
|
|
@ -136,21 +115,26 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
SingleItemDropDownMenu<Lookup, PpmElectricalSafetyProvider>(
|
|
|
|
|
context: context,
|
|
|
|
|
initialValue: widget.model.safetyId == null ? null : Lookup(name: widget.model.safetyName ?? "", id: widget.model.safetyId),
|
|
|
|
|
title: "Electrical Safety",
|
|
|
|
|
onSelect: (value) {
|
|
|
|
|
if (value != null) {
|
|
|
|
|
widget.model.safetyId = value.id;
|
|
|
|
|
widget.model.safetyName = value.name;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
SingleItemDropDownMenu<Lookup, PpmServiceProvider>(
|
|
|
|
|
context: context,
|
|
|
|
|
initialValue: widget.model.typeOfServiceId == null
|
|
|
|
|
? null
|
|
|
|
|
: Lookup(
|
|
|
|
|
name: widget.model.typeOfServiceName ?? "",
|
|
|
|
|
id: widget.model.typeOfServiceId),
|
|
|
|
|
initialValue: widget.model.typeOfServiceId == null ? null : Lookup(name: widget.model.typeOfServiceName ?? "", id: widget.model.typeOfServiceId),
|
|
|
|
|
title: context.translation.serviceType,
|
|
|
|
|
onSelect: (value) {
|
|
|
|
|
if (value != null) {
|
|
|
|
|
widget.model.typeOfServiceId = value.id;
|
|
|
|
|
widget.model.typeOfServiceName = value.name;
|
|
|
|
|
widget.model.safetyId = null;
|
|
|
|
|
widget.model.safetyName = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widget.model.supplierId = null;
|
|
|
|
|
widget.model.supplierName = null;
|
|
|
|
|
@ -159,30 +143,12 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
|
widget.model.suppPersonId = null;
|
|
|
|
|
widget.model.suppPerson = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
if (widget.model?.typeOfServiceId != 66) ...[
|
|
|
|
|
SingleItemDropDownMenu<Lookup, PpmElectricalSafetyProvider>(
|
|
|
|
|
context: context,
|
|
|
|
|
initialValue: widget.model.safetyId == null
|
|
|
|
|
? null
|
|
|
|
|
: Lookup(
|
|
|
|
|
name: widget.model.safetyName ?? "",
|
|
|
|
|
id: widget.model.safetyId),
|
|
|
|
|
title: "Electrical Safety",
|
|
|
|
|
onSelect: (value) {
|
|
|
|
|
if (value != null) {
|
|
|
|
|
widget.model.safetyId = value.id;
|
|
|
|
|
widget.model.safetyName = value.name;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
if (widget.model?.typeOfServiceId == 66) ...[
|
|
|
|
|
SingleItemDropDownMenu<SupplierDetails, VendorProvider>(
|
|
|
|
|
context: context,
|
|
|
|
|
@ -221,7 +187,7 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
|
8.height,
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
labelText: "Telephone",
|
|
|
|
|
initialValue: (widget.model.telephone ?? "").toString(),
|
|
|
|
|
initialValue: (widget.model.telephone ?? "").toString(),
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
|
@ -230,7 +196,6 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
|
|
AppTimer(
|
|
|
|
|
label: "External Supplier Timer",
|
|
|
|
|
timer: widget.model.externalEngineerTimer,
|
|
|
|
|
@ -245,7 +210,6 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
ADatePicker(
|
|
|
|
|
label: context.translation.actualVisitDate,
|
|
|
|
|
date: DateTime.tryParse(widget.model.actualDate ?? ""),
|
|
|
|
|
@ -253,8 +217,7 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
|
onDatePicker: (date) {
|
|
|
|
|
if (date == null) return;
|
|
|
|
|
if (date.isBefore(DateTime.parse(widget.model.expectedDate))) {
|
|
|
|
|
"Actual visit date must be greater then expected date"
|
|
|
|
|
.showToast;
|
|
|
|
|
"Actual visit date must be greater then expected date".showToast;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -288,18 +251,15 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
|
8.height,
|
|
|
|
|
MultiFilesPicker(
|
|
|
|
|
label: context.translation.attachImage,
|
|
|
|
|
files:
|
|
|
|
|
widget.model.files.map((e) => File(e.attachmentName)).toList(),
|
|
|
|
|
files: widget.model.files.map((e) => File(e.attachmentName)).toList(),
|
|
|
|
|
onChange: (files) {
|
|
|
|
|
widget.model.files = files
|
|
|
|
|
.map((e) => PpmAttachments(attachmentName: e.path))
|
|
|
|
|
.toList();
|
|
|
|
|
widget.model.files = files.map((e) => PpmAttachments(attachmentName: e.path)).toList();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
labelText: context.translation.comments,
|
|
|
|
|
initialValue: (widget.model.comments ?? "").toString(),
|
|
|
|
|
initialValue: (widget.model.comments ?? "").toString(),
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
onChange: (value) {
|
|
|
|
|
@ -313,8 +273,7 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
|
newSignature: widget.model.localNurseSignature,
|
|
|
|
|
onChange: (signature) {
|
|
|
|
|
widget.model.localNurseSignature = signature;
|
|
|
|
|
widget.model.nurseSignature =
|
|
|
|
|
"${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
|
widget.model.nurseSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
@ -324,8 +283,7 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
|
|
|
|
|
newSignature: widget.model.localEngineerSignature,
|
|
|
|
|
onChange: (signature) {
|
|
|
|
|
widget.model.localEngineerSignature = signature;
|
|
|
|
|
widget.model.engSignature =
|
|
|
|
|
"${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
|
widget.model.engSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
|