This commit is contained in:
2021-07-01 15:02:24 +00:00
parent 9504bed5db
commit 35fe54940b
2 changed files with 45 additions and 17 deletions

View File

@@ -27,18 +27,25 @@
</v-list-item-icon> </v-list-item-icon>
<v-list-item-title>{{ $ay.t("TaskGroup") }}</v-list-item-title> <v-list-item-title>{{ $ay.t("TaskGroup") }}</v-list-item-title>
</v-list-item> </v-list-item>
<v-list-item v-if="canDelete && isDeleted" @click="unDeleteItem">
<v-list-item-icon>
<v-icon>$ayiTrashRestoreAlt</v-icon>
</v-list-item-icon>
<v-list-item-title>{{ $ay.t("Undelete") }}</v-list-item-title>
</v-list-item>
<v-list-item v-if="canDelete && !isDeleted" @click="deleteItem"> <v-list-item v-if="canDelete && !isDeleted" @click="deleteItem">
<v-list-item-icon> <v-list-item-icon>
<v-icon>$ayiTrashAlt</v-icon> <v-icon>$ayiTrashAlt</v-icon>
</v-list-item-icon> </v-list-item-icon>
<v-list-item-title>{{ $ay.t("SoftDelete") }}</v-list-item-title> <v-list-item-title>{{ $ay.t("SoftDelete") }}</v-list-item-title>
</v-list-item> </v-list-item>
<v-list-item v-if="canDelete && isDeleted" @click="unDeleteItem"> <v-list-item v-if="canDeleteAll" @click="deleteAllItem">
<v-list-item-icon> <v-list-item-icon>
<v-icon>$ayiTrashRestoreAlt</v-icon> <v-icon>$ayiTrashAlt</v-icon>
</v-list-item-icon> </v-list-item-icon>
<v-list-item-title>{{ $ay.t("Undelete") }}</v-list-item-title> <v-list-item-title>{{
$ay.t("SoftDeleteAll")
}}</v-list-item-title>
</v-list-item> </v-list-item>
</v-list> </v-list>
</v-menu> </v-menu>
@@ -461,6 +468,13 @@ export default {
this.setDefaultView(); this.setDefaultView();
this.$emit("change"); this.$emit("change");
}, },
deleteAllItem() {
this.value.items[this.activeWoItemIndex].tasks.forEach(
z => (z.deleted = true)
);
this.setDefaultView();
this.$emit("change");
},
setDefaultView: function() { setDefaultView: function() {
//if only one record left then display it otherwise just let the datatable show what the user can click on //if only one record left then display it otherwise just let the datatable show what the user can click on
if (this.value.items[this.activeWoItemIndex].tasks.length == 1) { if (this.value.items[this.activeWoItemIndex].tasks.length == 1) {
@@ -614,11 +628,10 @@ export default {
return this.pvm.rights.change && this.pvm.subRights.tasks.create; return this.pvm.rights.change && this.pvm.subRights.tasks.create;
}, },
canDelete: function() { canDelete: function() {
return ( return this.activeItemIndex != null && this.canDeleteAll;
this.activeItemIndex != null && },
this.pvm.rights.change && canDeleteAll: function() {
this.pvm.subRights.tasks.delete return this.pvm.rights.change && this.pvm.subRights.tasks.delete;
);
} }
} }
}; };

View File

@@ -21,17 +21,25 @@
</v-list-item-icon> </v-list-item-icon>
<v-list-item-title>{{ $ay.t("New") }}</v-list-item-title> <v-list-item-title>{{ $ay.t("New") }}</v-list-item-title>
</v-list-item> </v-list-item>
<v-list-item v-if="canDelete && isDeleted" @click="unDeleteItem">
<v-list-item-icon>
<v-icon>$ayiTrashRestoreAlt</v-icon>
</v-list-item-icon>
<v-list-item-title>{{ $ay.t("Undelete") }}</v-list-item-title>
</v-list-item>
<v-list-item v-if="canDelete && !isDeleted" @click="deleteItem"> <v-list-item v-if="canDelete && !isDeleted" @click="deleteItem">
<v-list-item-icon> <v-list-item-icon>
<v-icon>$ayiTrashAlt</v-icon> <v-icon>$ayiTrashAlt</v-icon>
</v-list-item-icon> </v-list-item-icon>
<v-list-item-title>{{ $ay.t("SoftDelete") }}</v-list-item-title> <v-list-item-title>{{ $ay.t("SoftDelete") }}</v-list-item-title>
</v-list-item> </v-list-item>
<v-list-item v-if="canDelete && isDeleted" @click="unDeleteItem"> <v-list-item v-if="canDeleteAll" @click="deleteAllItem">
<v-list-item-icon> <v-list-item-icon>
<v-icon>$ayiTrashRestoreAlt</v-icon> <v-icon>$ayiTrashAlt</v-icon>
</v-list-item-icon> </v-list-item-icon>
<v-list-item-title>{{ $ay.t("Undelete") }}</v-list-item-title> <v-list-item-title>{{
$ay.t("SoftDeleteAll")
}}</v-list-item-title>
</v-list-item> </v-list-item>
</v-list> </v-list>
</v-menu> </v-menu>
@@ -527,6 +535,13 @@ export default {
this.setDefaultView(); this.setDefaultView();
this.$emit("change"); this.$emit("change");
}, },
deleteAllItem() {
this.value.items[this.activeWoItemIndex].travels.forEach(
z => (z.deleted = true)
);
this.setDefaultView();
this.$emit("change");
},
setDefaultView: function() { setDefaultView: function() {
//if only one record left then display it otherwise just let the datatable show what the user can click on //if only one record left then display it otherwise just let the datatable show what the user can click on
if (this.value.items[this.activeWoItemIndex].travels.length == 1) { if (this.value.items[this.activeWoItemIndex].travels.length == 1) {
@@ -909,12 +924,12 @@ export default {
return this.pvm.rights.change && this.pvm.subRights.travels.create; return this.pvm.rights.change && this.pvm.subRights.travels.create;
}, },
canDelete: function() { canDelete: function() {
return ( return this.activeItemIndex != null && this.canDeleteAll;
this.activeItemIndex != null && },
this.pvm.rights.change && canDeleteAll: function() {
this.pvm.subRights.travels.delete return this.pvm.rights.change && this.pvm.subRights.travels.delete;
);
} }
//---- //----
} }
}; };