Commit f8d553f9 authored by Julien BOUYER's avatar Julien BOUYER
Browse files

Merge branch 'feature/UNOTOPLYS-172_suppression_ecran' into 'develop'

Gestion de la suppression des écrans d'un questionnaire

See merge request !60
parents f7f82a73 1a90822e
...@@ -15195,19 +15195,6 @@ ...@@ -15195,19 +15195,6 @@
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true "dev": true
}, },
"node_modules/fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/function-bind": { "node_modules/function-bind": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
...@@ -23913,13 +23900,6 @@ ...@@ -23913,13 +23900,6 @@
"thenify-all": "^1.0.0" "thenify-all": "^1.0.0"
} }
}, },
"node_modules/nan": {
"version": "2.14.2",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz",
"integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==",
"dev": true,
"optional": true
},
"node_modules/nanoid": { "node_modules/nanoid": {
"version": "3.1.20", "version": "3.1.20",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz",
...@@ -35908,25 +35888,6 @@ ...@@ -35908,25 +35888,6 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/watchpack-chokidar2/node_modules/fsevents": {
"version": "1.2.13",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"deprecated": "fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.",
"dev": true,
"hasInstallScript": true,
"optional": true,
"os": [
"darwin"
],
"dependencies": {
"bindings": "^1.5.0",
"nan": "^2.12.1"
},
"engines": {
"node": ">= 4.0"
}
},
"node_modules/watchpack-chokidar2/node_modules/glob-parent": { "node_modules/watchpack-chokidar2/node_modules/glob-parent": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz",
...@@ -36737,20 +36698,6 @@ ...@@ -36737,20 +36698,6 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/webpack-dev-server/node_modules/fsevents": {
"version": "1.2.13",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"dev": true,
"hasInstallScript": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 4.0"
}
},
"node_modules/webpack-dev-server/node_modules/glob-parent": { "node_modules/webpack-dev-server/node_modules/glob-parent": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz",
...@@ -51243,13 +51190,6 @@ ...@@ -51243,13 +51190,6 @@
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true "dev": true
}, },
"fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"optional": true
},
"function-bind": { "function-bind": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
...@@ -58146,13 +58086,6 @@ ...@@ -58146,13 +58086,6 @@
"thenify-all": "^1.0.0" "thenify-all": "^1.0.0"
} }
}, },
"nan": {
"version": "2.14.2",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz",
"integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==",
"dev": true,
"optional": true
},
"nanoid": { "nanoid": {
"version": "3.1.20", "version": "3.1.20",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz",
...@@ -67857,17 +67790,6 @@ ...@@ -67857,17 +67790,6 @@
"to-regex-range": "^2.1.0" "to-regex-range": "^2.1.0"
} }
}, },
"fsevents": {
"version": "1.2.13",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"dev": true,
"optional": true,
"requires": {
"bindings": "^1.5.0",
"nan": "^2.12.1"
}
},
"glob-parent": { "glob-parent": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz",
...@@ -68535,13 +68457,6 @@ ...@@ -68535,13 +68457,6 @@
"locate-path": "^3.0.0" "locate-path": "^3.0.0"
} }
}, },
"fsevents": {
"version": "1.2.13",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"dev": true,
"optional": true
},
"glob-parent": { "glob-parent": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz",
insert into scope (id_user, id_role, wildcard) values (3, 4, false); insert into scope (id_user, id_role, wildcard) values (3, 4, false);
<<<<<<< HEAD
insert into scope_form (id_scope, id_form) SELECT currval('scope_id_seq'), 1101;
=======
insert into scope_form (id_scope, id_form) (SELECT currval('scope_id_seq'), 1101 where exists (select 1 from form where id = 1101)); insert into scope_form (id_scope, id_form) (SELECT currval('scope_id_seq'), 1101 where exists (select 1 from form where id = 1101));
>>>>>>> develop
import Vue from 'vue';
import Component from 'vue-class-component';
import { Prop } from 'vue-property-decorator';
@Component
export default class Confirm extends Vue {
@Prop()
public title: string;
@Prop()
public confirmLabel: string;
public cancel(event: Event): void {
this.$emit('cancel', event);
}
public confirm(event: Event): void {
this.$emit('confirm', event);
}
}
<template>
<div class="absolute pb-2 text-sm bg-white border rounded-md z-20 w-60 -right-4 top-2">
<p class="p-4">{{ title }}</p>
<button class="w-full px-4 py-1 text-left text-blue-600 hover:bg-blue-100 hover:text-blue-900" @click="cancel">
{{ $t('button.cancel') }}
</button>
<button class="w-full px-4 py-1 text-left text-red-600 hover:bg-red-100 hover:text-red-900" @click="confirm">{{ confirmLabel }}</button>
</div>
</template>
<script lang="ts" src="./confirm.component.ts" />
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</ol> </ol>
<!-- Tabs--> <!-- Tabs-->
<ul class="px-4 py-2 border-b md:flex md:justify-center md:text-center md:py-0"> <ul class="px-4 py-2 border-b md:flex md:justify-center md:text-center md:py-0">
<tab-item v-for="tab in tabs()" :title="tab.title" :link="tab.link" :state="tab.isCurrent ? 'current' : ''" /> <tab-item v-for="(tab, index) in tabs()" :key="index" :title="tab.title" :link="tab.link" :state="tab.isCurrent ? 'current' : ''" />
</ul> </ul>
</nav> </nav>
<login username="Bob" /> <login username="Bob" />
......
import Vue from 'vue'; import Vue from 'vue';
import { Component } from 'vue-property-decorator'; import { Component, Inject } from 'vue-property-decorator';
import ScreenService from '@/entities/screen/screen.service';
import { IScreen } from '@/shared/model/screen.model';
import Confirm from '@/components/confirm/confirm.vue';
import Icon from '@/components/icon/icon.vue'; import Icon from '@/components/icon/icon.vue';
@Component({ @Component({
components: { components: {
Confirm,
Icon, Icon,
}, },
}) })
export default class Panel extends Vue { export default class Panel extends Vue {
@Inject('screenService') private screenService: () => ScreenService;
public showConfirm: boolean;
constructor() {
super();
this.showConfirm = false;
}
public get screenList(): boolean { public get screenList(): boolean {
return this.$store.getters.screenList; return this.$store.getters.screenList;
} }
...@@ -41,4 +55,37 @@ export default class Panel extends Vue { ...@@ -41,4 +55,37 @@ export default class Panel extends Vue {
}); });
} }
} }
public deleteScreen() {
this.showConfirm = false;
const idScreen = Number.parseInt(this.$store.getters.idScreen, 10);
const idxScreen = this.$store.getters.screenList.findIndex((s: IScreen) => s.id === idScreen);
this.screenService()
.delete(idScreen)
.then(res => {
this.reload(idxScreen);
})
.catch(console.error);
}
public reload(idxScreen: number) {
const screenList = this.$store.getters.screenList;
screenList.splice(idxScreen, 1);
let screen: IScreen;
if (idxScreen === screenList.length) {
screen = screenList[screenList.length - 1];
} else {
screen = screenList[idxScreen];
}
if (screen) {
this.$router.push({
name: 'ScreenEditComponent',
params: {
idWorkspace: this.$store.getters.idWorkspace,
idForm: this.$store.getters.idForm,
idScreen: `${screen.id}`,
},
});
}
}
} }
...@@ -9,9 +9,19 @@ ...@@ -9,9 +9,19 @@
<icon name="add" /> <icon name="add" />
<span class="ml-2">{{ $t('screen.add') }}</span> <span class="ml-2">{{ $t('screen.add') }}</span>
</router-link> </router-link>
<button class="flex items-center p-2 text-red-600 transition hover:bg-red-600 focus:ring hover:text-red-100"> <button
class="flex items-center p-2 text-red-600 transition hover:bg-red-600 focus:ring hover:text-red-100"
@click="showConfirm = true"
>
<icon name="trash" /> <icon name="trash" />
</button> </button>
<confirm
v-if="showConfirm"
:title="$t('screen.label.delete')"
:confirmLabel="$t('button.delete')"
@cancel="showConfirm = false"
@confirm="deleteScreen"
/>
</div> </div>
<ol class="p-2 text-sm select-none"> <ol class="p-2 text-sm select-none">
<li <li
......
import { Module } from 'vuex'; import { Module } from 'vuex';
import FormService from '@/entities/form/form.service';
import ScreenService from '@/entities/screen/screen.service'; import ScreenService from '@/entities/screen/screen.service';
const formService = new FormService();
const screenService = new ScreenService(); const screenService = new ScreenService();
export const formStore: Module<any, any> = { export const formStore: Module<any, any> = {
......
...@@ -145,7 +145,9 @@ ...@@ -145,7 +145,9 @@
}, },
"footer": "Ceci est votre pied de page", "footer": "Ceci est votre pied de page",
"button": { "button": {
"save": "Enregistrer" "save": "Enregistrer",
"cancel": "Annuler",
"delete": "Supprimer"
}, },
"onglets": { "onglets": {
"parametrages": "Paramétrages", "parametrages": "Paramétrages",
......
...@@ -44,7 +44,8 @@ ...@@ -44,7 +44,8 @@
"helpText": "Cette information est utilisée pour définir l'URL de l'étape (ex: https://apply.univ-nantes.fr/form/staps/<strong>ref1</strong>)" "helpText": "Cette information est utilisée pour définir l'URL de l'étape (ex: https://apply.univ-nantes.fr/form/staps/<strong>ref1</strong>)"
}, },
"description": "Description", "description": "Description",
"newItemType": "Type de l'item à ajouter" "newItemType": "Type de l'item à ajouter",
"delete": "Voulez-vous vraiment supprimer cet écran ?"
}, },
"items": { "items": {
"newLabelPlaceholder": "Ajouter un libellé...", "newLabelPlaceholder": "Ajouter un libellé...",
......
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