startTask method

  1. @override
Future<void> startTask(
  1. AppModel app,
  2. BuildContext context,
  3. String? memberId,
  4. AssignmentModel? assignmentModel,
)
override

Implementation

@override
Future<void> startTask(AppModel app, BuildContext context, String? memberId,
    AssignmentModel? assignmentModel) {
  if (assignmentModel == null) return Future.value(null);
  if (memberId == null) {
    throw Exception("Can't approve membership when no member");
  }
  String? feedback;
  openWidgetDialog(
    app,
    context,
    '${app.documentID}/membershipreq',
    child: YesNoIgnoreDialogWithAssignmentResults.get(app, context,
        title: 'Membership request',
        message:
            'Below the payment details. Please review and confirm or decline and provide feedback.',
        yesLabel: 'Confirm membership',
        noLabel: 'Decline membership',
        resultsPrevious: assignmentModel.resultsPrevious,
        yesFunction: () async {
      await _approveMembershipRequest(
          app, context, memberId, assignmentModel, feedback);
    }, noFunction: () async {
      await _disapproveMembershipRequest(
          app, context, memberId, assignmentModel, feedback);
    }, extraFields: [
      getListTile(context, app,
          leading: Icon(Icons.payment),
          title: dialogField(
            app,
            context,
            valueChanged: (value) => feedback = value,
            decoration: const InputDecoration(
              hintText: 'Feedback to the member',
              labelText: 'Feedback to the member',
            ),
          )),
    ]),
  );
  return Future.value(null);
}