Commit aa43fe21 authored by Kevin Robert's avatar Kevin Robert
Browse files

UNOTOPLYS-193 : Mise en place de la suppression d'une variable via la liste des variables.

parent cc8561e7
...@@ -3,10 +3,13 @@ import Component from 'vue-class-component'; ...@@ -3,10 +3,13 @@ import Component from 'vue-class-component';
import HeaderService from '@/shared/service/header-service'; import HeaderService from '@/shared/service/header-service';
import VariableService from '@/entities/variable/variable.service'; import VariableService from '@/entities/variable/variable.service';
import Toolbar from '@/components/toolbar/toolbar.vue'; import Toolbar from '@/components/toolbar/toolbar.vue';
import Icon from '@/components/icon/icon.vue';
import {IVariable} from "@/shared/model/variable.model";
@Component({ @Component({
components: { components: {
Toolbar, Toolbar,
Icon
}, },
}) })
export default class VariableList extends Vue { export default class VariableList extends Vue {
...@@ -20,7 +23,7 @@ export default class VariableList extends Vue { ...@@ -20,7 +23,7 @@ export default class VariableList extends Vue {
@Inject('headerService') @Inject('headerService')
private headerService: () => HeaderService; private headerService: () => HeaderService;
public variables: any[] = []; public variables: IVariable[] = [];
public idForm: string = ''; public idForm: string = '';
...@@ -50,4 +53,9 @@ export default class VariableList extends Vue { ...@@ -50,4 +53,9 @@ export default class VariableList extends Vue {
public createVariablePath(): string { public createVariablePath(): string {
return `/admin/workspace/${this.idWorkspace}/form/${this.idForm}/variable/creation`; return `/admin/workspace/${this.idWorkspace}/form/${this.idForm}/variable/creation`;
} }
public deleteVariable(variable: IVariable) {
this.variables = this.variables.filter(value => value.id !== variable.id);
this.variableService().delete(variable.id);
}
} }
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<th class="p-2 text-left" v-text="$t('variable.id')">ID</th> <th class="p-2 text-left" v-text="$t('variable.id')">ID</th>
<th class="p-2 text-left" v-text="$t('variable.name')">Nom</th> <th class="p-2 text-left" v-text="$t('variable.name')">Nom</th>
<th class="p-2 text-left" v-text="$t('variable.reference')">Réference</th> <th class="p-2 text-left" v-text="$t('variable.reference')">Réference</th>
<th class="p-2 text-center" v-text="$t('variable.actions')">Actions</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
...@@ -21,6 +22,11 @@ ...@@ -21,6 +22,11 @@
<td class="p-2"> <td class="p-2">
<a :href="getVariableEditLink(variable.id)">{{ variable.reference }}</a> <a :href="getVariableEditLink(variable.id)">{{ variable.reference }}</a>
</td> </td>
<td class="p-2">
<button class="flex items-center p-2 text-red-600 transition ml-auto mr-auto hover:bg-red-600 focus:ring hover:text-red-100" @click="deleteVariable(variable)">
<icon name="trash"></icon>
</button>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
"name": "Nom", "name": "Nom",
"reference": "Référence", "reference": "Référence",
"description": "Description", "description": "Description",
"expression": "Expression" "expression": "Expression",
"actions": "Actions"
} }
} }
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