Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add functionality for fetching myTemplates and sharedTemplates
  • Loading branch information
mcraeteisha committed Aug 28, 2024
commit 917fd223adcc7210c63edb8ec85e71e046c3ed93
34 changes: 34 additions & 0 deletions resources/js/processes/screen-builder/screen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@
:render-controls="displayBuilder"
:process-id="processId"
:show-templates-panel="showTemplatesPanel"
:my-templates-data="myTemplatesData"
:shared-templates-data="sharedTemplatesData"
@change="updateConfig"
@close-templates-panel="closeTemplatesPanel"
@show-shared-templates="fetchSharedTemplates"
>
<data-loading-basic :is-loaded="false" />
</vue-form-builder>
Expand Down Expand Up @@ -606,6 +609,8 @@ export default {
},
iframeHeight: "600px",
showTemplatesPanel: false,
myTemplatesData: null,
sharedTemplatesData: null,
};
},
computed: {
Expand Down Expand Up @@ -1030,13 +1035,42 @@ export default {
this.$refs.builder.redo();
},
openTemplatesPanel() {
//Filter to retrieve my templates. When select shared templates, refetch.
this.fetchMyTemplates();
console.log('HIT OPEN TEMPLATE PANEL');
this.showTemplatesPanel = true;
},
closeTemplatesPanel() {
console.log('HIT CLOSE TEMPLATE PANEL');
this.showTemplatesPanel = false;
},
fetchMyTemplates() {
ProcessMaker.apiClient
.get(
"templates/screen?is_public=0",
)
.then((response) => {
this.myTemplatesData = response.data.data;
console.log('myTemplatesData RETRIEVED', this.myTemplatesData);
})
.catch((error) => {
console.error(error);
});
},
fetchSharedTemplates() {
ProcessMaker.apiClient
.get(
"templates/screen?is_public=1",
)
.then((response) => {
this.sharedTemplatesData = response.data.data;
console.log('sharedTemplatesData RETRIEVED', this.sharedTemplatesData);
this.$emit('shared-templates-loaded');
})
.catch((error) => {
console.error(error);
});
},
openComputedProperties() {
this.$refs.computedProperties.show();
},
Expand Down