-
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.
Merge pull request #1442 from ProcessMaker/feature/FOUR-9501
FOUR-9501: Create control LIST TABLE
- Loading branch information
Showing
6 changed files
with
156 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
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
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,34 @@ | ||
<template> | ||
<div> | ||
<label class="typo__label">{{ $t("Select Chart Type") }}</label> | ||
<multiselect | ||
v-model="selectedOption" | ||
:placeholder="$t('Select option')" | ||
:internal-search="false" | ||
:show-labels="false" | ||
:options="options" | ||
label="title" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
data() { | ||
return { | ||
selectedOption: null, | ||
options: [ | ||
{ title: this.$t("My Tasks") }, | ||
{ title: this.$t("My Requests") }, | ||
{ title: this.$t("Start new Request") } | ||
] | ||
}; | ||
}, | ||
watch: { | ||
selectedOption(newValue) { | ||
// when Multiselect option is selected, an event is emmited to notify form-list-table component | ||
window.ProcessMaker.EventBus.$emit("option-selected", newValue.title); | ||
} | ||
} | ||
}; | ||
</script> |
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,91 @@ | ||
<template> | ||
<div class="container mt-4"> | ||
<div class="card"> | ||
<div | ||
class="card-header d-flex justify-content-between align-items-center" | ||
> | ||
<h4>{{ title }}</h4> | ||
<div> | ||
<i class="fas fa-search" /> | ||
</div> | ||
</div> | ||
<div> | ||
<vuetable :api-mode="false" :fields="fields" :data="tableData"> | ||
</vuetable> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
data() { | ||
return { | ||
title: this.$t("List Table"), | ||
fields: [ | ||
{ | ||
name: "created_at", | ||
title: () => "Created At" | ||
}, | ||
{ | ||
name: "due_at", | ||
title: () => "Due At" | ||
}, | ||
{ | ||
name: "element_name", | ||
title: () => "Element Name" | ||
} | ||
], | ||
data: [], | ||
tableData: [] | ||
}; | ||
}, | ||
created() { | ||
window.ProcessMaker.EventBus.$on("option-selected", (option) => { | ||
this.title = option; | ||
this.populateFields(this.title); | ||
}); | ||
}, | ||
methods: { | ||
callAPI(url) { | ||
try { | ||
ProcessMaker.apiClient.get(url).then((response) => { | ||
this.tableData = response.data; | ||
}); | ||
} catch (error) { | ||
console.error("Error fetching data:", error); | ||
} | ||
}, | ||
populateFields(option) { | ||
this.fields = []; | ||
if (option === "My Tasks") { | ||
this.callAPI("/tasks"); | ||
} | ||
if (option === "My Requests") { | ||
this.callAPI("/requests"); | ||
} | ||
if (option === "Start new Request") { | ||
this.callAPI("/requests"); | ||
} | ||
/* | ||
This code is needed because fields in vuetable2 are not reactive | ||
TO-DO: Vuetable component should be imported from CORE to use normalizeFields | ||
import datatableMixin from "../../components/common/mixins/datatable"; | ||
Uncomment code below when import is done | ||
this.$nextTick(() => { | ||
this.$refs.vuetable.normalizeFields(); | ||
}); | ||
*/ | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<style lang="scss"> | ||
.prevent-interaction.form-list-table::after { | ||
content: attr(placeholder); | ||
} | ||
</style> |
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
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