This commit is contained in:
2021-06-30 22:56:17 +00:00
parent 7e3a964c05
commit e03af82f5e
8 changed files with 147 additions and 69 deletions

View File

@@ -21,17 +21,25 @@
</v-list-item-icon>
<v-list-item-title>{{ $ay.t("New") }}</v-list-item-title>
</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-icon>
<v-icon>$ayiTrashAlt</v-icon>
</v-list-item-icon>
<v-list-item-title>{{ $ay.t("SoftDelete") }}</v-list-item-title>
</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-icon>$ayiTrashRestoreAlt</v-icon>
<v-icon>$ayiTrashAlt</v-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>
</v-menu>
@@ -527,6 +535,13 @@ export default {
this.setDefaultView();
this.$emit("change");
},
deleteAllItem() {
this.value.items[this.activeWoItemIndex].labors.forEach(
z => (z.deleted = true)
);
this.setDefaultView();
this.$emit("change");
},
setDefaultView: function() {
//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].labors.length == 1) {
@@ -908,11 +923,10 @@ export default {
return this.pvm.rights.change && this.pvm.subRights.labors.create;
},
canDelete: function() {
return (
this.activeItemIndex != null &&
this.pvm.rights.change &&
this.pvm.subRights.labors.delete
);
return this.activeItemIndex != null && this.canDeleteAll;
},
canDeleteAll: function() {
return this.pvm.rights.change && this.pvm.subRights.labors.delete;
}
//----
}