From c5bc6e1ff6d72fce34c6b70783ca15e09994a5d7 Mon Sep 17 00:00:00 2001 From: Daniel Vargas Date: Fri, 12 Jan 2024 14:39:58 -0600 Subject: [PATCH] Stores task when a task resource is passed in the appContext --- src/components/QuestionnaireForm/QuestionnaireForm.jsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/QuestionnaireForm/QuestionnaireForm.jsx b/src/components/QuestionnaireForm/QuestionnaireForm.jsx index 8e9d0b03..726ab27a 100644 --- a/src/components/QuestionnaireForm/QuestionnaireForm.jsx +++ b/src/components/QuestionnaireForm/QuestionnaireForm.jsx @@ -6,6 +6,7 @@ import shortid from "shortid"; import _ from "lodash"; import ConfigData from "../../config.json"; import ReactDOM from 'react-dom' +import {createTask} from "../../util/taskCreation"; import retrieveQuestions, { buildNextQuestionRequest } from "../../util/retrieveQuestions"; @@ -1052,6 +1053,7 @@ export default class QuestionnaireForm extends Component { if (status == "in-progress") { const showPopup = !this.isAdaptiveForm() || this.isAdaptiveFormWithoutItem(); this.storeQuestionnaireResponseToEhr(qr, showPopup); + createTask(JSON.parse(this.appContext.task), this.props.smart); this.popupClear("Partially completed form (QuestionnaireResponse) saved to EHR", "OK", true); if(showPopup) { this.popupLaunch(); @@ -1123,6 +1125,10 @@ export default class QuestionnaireForm extends Component { this.generateAndStoreDocumentReference(qr, priorAuthBundle); this.storeQuestionnaireResponseToEhr(qr, false); + //If the app context contains a Task, save it + //TODO: Handle when a task updates or is already saved + createTask(JSON.parse(this.appContext.task), this.props.smart); + const priorAuthClaim = { resourceType: "Claim", status: "active",