Update approve and block visitRequest logic
This commit is contained in:
parent
00bdbc8b68
commit
d2807fdaa6
|
@ -44,8 +44,8 @@
|
|||
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
6436409D27A31CDB00820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
6436409727A31CDD00820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
6436409627A31CD500820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
6436409C27A31CD700820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
|
@ -225,8 +225,8 @@
|
|||
6436409C27A31CD800820AF7 /* InfoPlist.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
6436409D27A31CDB00820AF7 /* pt */,
|
||||
6436409727A31CDD00820AF7 /* en */,
|
||||
6436409627A31CD500820AF7 /* pt */,
|
||||
6436409C27A31CD700820AF7 /* en */,
|
||||
);
|
||||
name = InfoPlist.strings;
|
||||
sourceTree = "<group>";
|
||||
|
|
|
@ -24,6 +24,10 @@ class VisitRequestTemplateComponentModel
|
|||
FocusNode? textFieldFocusNode4;
|
||||
TextEditingController? textController4;
|
||||
String? Function(BuildContext, String?)? textController4Validator;
|
||||
// Stores action output result for [Action Block - visitRequestComponentAction] action in IconButton widget.
|
||||
bool? blockVisitRequest;
|
||||
// Stores action output result for [Action Block - visitRequestComponentAction] action in IconButton widget.
|
||||
bool? approveVisitRequest;
|
||||
|
||||
@override
|
||||
void initState(BuildContext context) {}
|
||||
|
@ -44,7 +48,7 @@ class VisitRequestTemplateComponentModel
|
|||
}
|
||||
|
||||
/// Action blocks.
|
||||
Future visitRequestComponentAction(
|
||||
Future<bool> visitRequestComponentAction(
|
||||
BuildContext context, {
|
||||
required String? actionValue,
|
||||
required String? refUUID,
|
||||
|
@ -69,8 +73,9 @@ class VisitRequestTemplateComponentModel
|
|||
) ==
|
||||
false) {
|
||||
Navigator.pop(context);
|
||||
return true;
|
||||
} else {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -391,14 +391,24 @@ class _VisitRequestTemplateComponentWidgetState
|
|||
size: 24.0,
|
||||
),
|
||||
onPressed: () async {
|
||||
await _model.visitRequestComponentAction(
|
||||
var shouldSetState = false;
|
||||
_model.blockVisitRequest =
|
||||
await _model.visitRequestComponentAction(
|
||||
context,
|
||||
actionValue: 'B',
|
||||
refUUID: widget.vawRef,
|
||||
responseValue: _model.textController4.text,
|
||||
vteUUID: widget.vteUUID,
|
||||
);
|
||||
setState(() {});
|
||||
shouldSetState = true;
|
||||
if (_model.blockVisitRequest == true) {
|
||||
Navigator.pop(context);
|
||||
} else {
|
||||
if (shouldSetState) setState(() {});
|
||||
return;
|
||||
}
|
||||
|
||||
if (shouldSetState) setState(() {});
|
||||
},
|
||||
),
|
||||
FlutterFlowIconButton(
|
||||
|
@ -412,14 +422,24 @@ class _VisitRequestTemplateComponentWidgetState
|
|||
size: 24.0,
|
||||
),
|
||||
onPressed: () async {
|
||||
await _model.visitRequestComponentAction(
|
||||
var shouldSetState = false;
|
||||
_model.approveVisitRequest =
|
||||
await _model.visitRequestComponentAction(
|
||||
context,
|
||||
actionValue: 'L',
|
||||
refUUID: widget.vawRef,
|
||||
responseValue: _model.textController4.text,
|
||||
vteUUID: widget.vteUUID,
|
||||
);
|
||||
setState(() {});
|
||||
shouldSetState = true;
|
||||
if (_model.approveVisitRequest == true) {
|
||||
Navigator.pop(context);
|
||||
} else {
|
||||
if (shouldSetState) setState(() {});
|
||||
return;
|
||||
}
|
||||
|
||||
if (shouldSetState) setState(() {});
|
||||
},
|
||||
),
|
||||
].divide(const SizedBox(width: 20.0)),
|
||||
|
|
Loading…
Reference in New Issue