Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 6 additions & 6 deletions resources/js/processes/screens/components/CreateScreenModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
v-if="isProjectsInstalled"
v-model="formData.projects"
:errors="errors.projects"
:projectId="projectId"
:project-id="projectId"
:label="$t('Project')"
:required="isProjectSelectionRequired"
api-get="projects"
Expand Down Expand Up @@ -161,13 +161,13 @@ export default {
this.resetFormData();
this.resetErrors();
if (this.isQuickCreate === true) {
this.screenTypes = filterScreenType();
this.screenTypes = filterScreenType() ?? this.types;
// in any case the screenType if the only one, default to the first value
if (Object.keys(this.screenTypes).length === 1) this.formData.type = Object.keys(this.screenTypes)[0];
}
if (this.callFromAiModeler === true) {
this.screenTypes = this.types;
}
}
},
methods: {
show() {
Expand All @@ -193,10 +193,10 @@ export default {
this.resetErrors();
},
close() {
this.$bvModal.hide('createScreen');
this.$bvModal.hide("createScreen");
this.disabled = false;
this.$emit('reload');
},
this.$emit("reload");
},
onSubmit() {
this.resetErrors();
// single click
Expand Down
4 changes: 3 additions & 1 deletion resources/js/utils/filterScreenType.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { ScreenTypes } from "../models/screens";

/**
* Filter the screen types based on the task
* @return {?Object};
*/
export function filterScreenType() {
const screen = new URLSearchParams(window.location.search).get("screenType").split(",");
const screen = new URLSearchParams(window.location.search).get("screenType")?.split(",");
if (!screen) return;
return Object.fromEntries(Object.entries(ScreenTypes).filter(([key]) => screen.includes(key)));
}