import SearchCategories from "./utils/SearchCategories.vue";
import SelectTemplateModal from "../../components/templates/SelectTemplateModal.vue";
+import { EventBus } from '../index.js';
export default {
components: {
@@ -148,6 +149,11 @@ export default {
comeFromProcess: false,
};
},
+ created() {
+ EventBus.$on('templates-selected', (obj) => {
+ this.openTemplate(obj);
+ });
+ },
computed: {
/**
* Filters options regarding user permissions
@@ -172,12 +178,6 @@ export default {
}
},
watch: {
- selectedProcessItem: {
- deep: true,
- handler: function () {
- this.$emit('categorySelected', this.selectedProcessItem);
- },
- },
$route(r) {
this.handleRouteQuery();
},
@@ -204,6 +204,9 @@ export default {
this.selectedProcessItem = this.data.find((category) => {
return String(category.id) === String(query.categoryId);
});
+ this.selectedTemplateItem = this.filteredTemplateOptions.find((category) => {
+ return String(category.id) === String(query.categoryId);
+ });
}
},
/**
@@ -216,6 +219,7 @@ export default {
this.comeFromProcess = false;
this.selectedProcessItem = item;
this.selectedTemplateItem = null;
+ this.$emit('categorySelected', item);
},
/**
* Enables All Templates option only if user has create-processes permission
@@ -229,13 +233,9 @@ export default {
return obj.id === "guided_templates";
});
}
- if (item.id === "all_templates") {
- this.addNewProcess();
- return;
- }
this.selectedTemplateItem = item;
this.selectedProcessItem = null;
- this.$emit('categorySelected', this.selectedTemplateItem);
+ this.$emit('categorySelected', item);
},
/**
* This method opens New Process modal window
@@ -245,11 +245,20 @@ export default {
this.$refs.addProcessModal.show();
});
},
+ openTemplate(obj) {
+ this.$nextTick(() => {
+ this.$refs.addProcessModal.show();
+ this.$refs.addProcessModal.$nextTick(() => {
+ this.$refs.addProcessModal.$refs["template-search"].showDetails(obj);
+ this.$refs.addProcessModal.hideBackButton();
+ });
+ });
+ },
isSelectedProcess(item) {
return this.selectedProcessItem === item;
},
- isSelectedTemplate(index) {
- return this.selectedTemplateItem === index;
+ isSelectedTemplate(item) {
+ return this.selectedTemplateItem === item;
},
onToggleCatalogue() {
this.showCatalogue = !this.showCatalogue;
diff --git a/resources/js/processes-catalogue/components/utils/Card.vue b/resources/js/processes-catalogue/components/utils/Card.vue
index 31fc32815b..5f7b10fd79 100644
--- a/resources/js/processes-catalogue/components/utils/Card.vue
+++ b/resources/js/processes-catalogue/components/utils/Card.vue
@@ -33,6 +33,7 @@
export default {
- props: ["process"],
+ props: {
+ process: null,
+ hideBookmark: {
+ type: Boolean,
+ default: false
+ }
+ },
data() {
return {
labelIcon: "Default Icon",
diff --git a/resources/js/processes-catalogue/index.js b/resources/js/processes-catalogue/index.js
index 85c431a223..0b7630ff87 100644
--- a/resources/js/processes-catalogue/index.js
+++ b/resources/js/processes-catalogue/index.js
@@ -3,6 +3,7 @@ import Process from "./components/Process";
import ProcessesCatalogue from "./components/ProcessesCatalogue";
import ProcessListing from "./components/ProcessListing";
+export const EventBus = new Vue();
Vue.use(VueRouter);
const router = new VueRouter({
mode: "history",