-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rodrigo Quelca
committed
Oct 4, 2024
1 parent
f18387a
commit 0dd03c9
Showing
4 changed files
with
14,198 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<template> | ||
<b-row> | ||
<b-col cols="8"> | ||
<b-tabs> | ||
<b-tab active title="Form"> | ||
<task | ||
v-model="data" | ||
:initial-request-id="task.process_request.id" | ||
:initial-task-id="task.id" | ||
@submit="submit" | ||
/> | ||
</b-tab> | ||
<b-tab title="Data"> | ||
<monaco-editor | ||
class="data-editor" | ||
language="json" | ||
:value="JSON.stringify(data, null, 4)" | ||
:options="{ automaticLayout: true, minimap: { enabled: false } }" | ||
/> | ||
<div class="text-right"> | ||
<b-button variant="secondary">{{ __("Save") }}</b-button> | ||
</div> | ||
</b-tab> | ||
</b-tabs> | ||
</b-col> | ||
</b-row> | ||
</template> | ||
|
||
<script> | ||
import moment from "moment"; | ||
import MonacoEditor from "vue-monaco"; | ||
import Screens from "../e2e/fixtures/webentry.json"; | ||
export default { | ||
components: { MonacoEditor }, | ||
data() { | ||
return { | ||
data: {}, | ||
task: { | ||
id: 1, | ||
advanceStatus: "open", | ||
component: "task-screen", | ||
created_at: moment().toISOString(), | ||
completed_at: moment().toISOString(), | ||
due_at: moment().add(1, "day").toISOString(), | ||
user: { | ||
avatar: "", | ||
fullname: "Assigned User" | ||
}, | ||
screen: Screens.screens[0], | ||
process_request: { | ||
id: 1, | ||
status: "ACTIVE", | ||
user: { | ||
avatar: "", | ||
fullname: "Requester User" | ||
} | ||
}, | ||
process: { | ||
id: 1, | ||
name: "Process Name" | ||
}, | ||
request_data: {} | ||
} | ||
}; | ||
}, | ||
methods: { | ||
moment(...args) { | ||
return moment(...args); | ||
}, | ||
__(text) { | ||
return text; | ||
}, | ||
formatDate(date) { | ||
return moment(date).format("YYYY-MM-DD HH:mm"); | ||
}, | ||
submit(task) { | ||
if (this.disabled) { | ||
return; | ||
} | ||
this.disabled = true; | ||
const taskId = task.id; | ||
const formData = task.request_data; | ||
window.ProcessMaker.apiClient | ||
.put(`/tasks/${taskId}`, { status: "COMPLETED", data: formData }) | ||
.then(() => { | ||
alert("Task Completed Successfully"); | ||
}) | ||
.finally(() => { | ||
this.disabled = false; | ||
}); | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<style scoped> | ||
.data-editor { | ||
border: 1px solid gray; | ||
min-height: 400px; | ||
} | ||
</style> |
Oops, something went wrong.