Commit 290785e4 authored by Kevin Robert's avatar Kevin Robert
Browse files

UNOTOPLYS-165 : Mise en place de la consultation d'un écran.

parent 0dd5a87c
......@@ -13,6 +13,10 @@ export default class Panel extends Vue {
return this.$store.getters.screenList;
}
public isCurrentPanel(panel) {
return this.idScreen == panel.id;
}
public get idWorkspace(): string {
return this.$store.getters.idWorkspace;
}
......@@ -20,4 +24,21 @@ export default class Panel extends Vue {
public get idForm(): string {
return this.$store.getters.idForm;
}
public get idScreen(): string {
return this.$store.getters.idScreen;
}
public selectScreen(screen) {
if (screen.id != this.idScreen) {
this.$router.push({
name: "ScreenEditComponent",
params: {
idWorkspace: this.idWorkspace,
idForm: this.idForm,
idScreen: screen.id
}
})
}
}
}
......@@ -19,15 +19,16 @@
:key="panelScreen.index"
:class="[
'flex items-center p-1 leading-tight transition rounded-md cursor-pointer group hover:absolute focus:ring ',
panelScreen.current ? 'font-medium text-white bg-blue-600 hover:bg-blue-700' : 'hover:bg-blue-100',
isCurrentPanel(panelScreen) ? 'font-medium text-white bg-blue-600 hover:bg-blue-700' : 'hover:bg-blue-100',
]"
tabindex="0"
role="button"
@click="selectScreen(panelScreen)"
>
<span
:class="[
'flex-shrink-0 inline-block w-8 h-6 mr-2 text-sm text-center border rounded-md',
panelScreen.current
isCurrentPanel(panelScreen)
? 'text-blue-900 bg-blue-100 border-white group-hover:border-blue-900-400'
: 'bg-white border-gray-300 group-hover:border-gray-400',
]"
......
......@@ -27,12 +27,21 @@ export default class ScreenEdit extends Vue {
beforeRouteEnter(to, from, next) {
next(vm => {
vm.$store.commit('setIdWorkspace', to.params.idWorkspace);
vm.$store.commit('setIdForm', to.params.idForm);
vm.$store.commit('setIdScreen', to.params.idScreen);
vm.$store.dispatch('loadScreens', to.params.idForm);
vm.retrieveScreen(to.params.idScreen);
});
vm.handleNavigationChange(to);
})
}
beforeRouteUpdate(to, from, next) {
this.handleNavigationChange(to);
next();
}
public handleNavigationChange(to) {
this.$store.commit('setIdWorkspace', to.params.idWorkspace);
this.$store.commit('setIdForm', to.params.idForm);
this.$store.commit('setIdScreen', to.params.idScreen);
this.$store.dispatch('loadScreens', to.params.idForm);
this.retrieveScreen(to.params.idScreen);
}
public get stepNum(): number {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment