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

@@ -436,10 +436,8 @@ CURRENTLY DOING: template replacement additions
Close case 3897 after this is done
bugbug: can't delete workorder if there is any of the following items on any of it's woitems
woitempart
woitemexpenese
bugbug: missing code to delete all items in woitem where it's children get deleted?
see work-order-items.vue delete item and delete all item and undelete item

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>
@@ -522,6 +530,13 @@ export default {
this.setDefaultView();
this.$emit("change");
},
deleteAllItem() {
this.value.items[this.activeWoItemIndex].expenses.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 (
@@ -751,11 +766,10 @@ export default {
return this.pvm.rights.change && this.pvm.subRights.expenses.create;
},
canDelete: function() {
return (
this.activeItemIndex != null &&
this.pvm.rights.change &&
this.pvm.subRights.expenses.delete
);
return this.activeItemIndex != null && this.canDeleteAll;
},
canDeleteAll: function() {
return this.pvm.rights.change && this.pvm.subRights.expenses.delete;
}
}
};

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;
}
//----
}

View File

@@ -19,7 +19,14 @@
<v-list-item-icon>
<v-icon>$ayiPlus</v-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-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>
@@ -27,11 +34,13 @@
</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>
@@ -510,6 +519,13 @@ export default {
this.setDefaultView();
this.$emit("change");
},
deleteAllItem() {
this.value.items[this.activeWoItemIndex].loans.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].loans.length == 1) {
@@ -805,12 +821,12 @@ export default {
return this.pvm.rights.change && this.pvm.subRights.loans.create;
},
canDelete: function() {
return (
this.activeItemIndex != null &&
this.pvm.rights.change &&
this.pvm.subRights.loans.delete
);
return this.activeItemIndex != null && this.canDeleteAll;
},
canDeleteAll: function() {
return this.pvm.rights.change && this.pvm.subRights.loans.delete;
}
//----
}
};

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>
@@ -716,6 +724,13 @@ export default {
this.setDefaultView();
this.$emit("change");
},
deleteAllItem() {
this.value.items[this.activeWoItemIndex].outsideServices.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 (
@@ -1069,12 +1084,14 @@ export default {
);
},
canDelete: function() {
return this.activeItemIndex != null && this.canDeleteAll;
},
canDeleteAll: function() {
return (
this.activeItemIndex != null &&
this.pvm.rights.change &&
this.pvm.subRights.outsideServices.delete
this.pvm.rights.change && this.pvm.subRights.outsideServices.delete
);
}
//----
}
};

View File

@@ -16,17 +16,25 @@
</div>
</template>
<v-list>
<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>
@@ -158,6 +166,13 @@ export default {
this.setDefaultView();
this.$emit("change");
},
deleteAllItem() {
this.value.items[this.activeWoItemIndex].partRequests.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].partRequests.length == 1) {
@@ -361,12 +376,12 @@ export default {
// return this.pvm.rights.change && this.pvm.subRights.partRequests.create;
// },
canDelete: function() {
return (
this.activeItemIndex != null &&
this.pvm.rights.change &&
this.pvm.subRights.partRequests.delete
);
return this.activeItemIndex != null && this.canDeleteAll;
},
canDeleteAll: function() {
return this.pvm.rights.change && this.pvm.subRights.partRequests.delete;
}
//----
}
};

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>
@@ -370,6 +378,13 @@ export default {
this.setDefaultView();
this.$emit("change");
},
deleteAllItem() {
this.value.items[this.activeWoItemIndex].scheduledUsers.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].scheduledUsers.length == 1) {
@@ -611,11 +626,10 @@ export default {
return this.pvm.rights.change && this.pvm.subRights.scheduledUsers.create;
},
canDelete: function() {
return (
this.activeItemIndex != null &&
this.pvm.rights.change &&
this.pvm.subRights.scheduledUsers.delete
);
return this.activeItemIndex != null && this.canDeleteAll;
},
canDeleteAll: function() {
return this.pvm.rights.change && this.pvm.subRights.scheduledUsers.delete;
}
}
};

View File

@@ -29,7 +29,7 @@
</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="deleteAllItem">
<v-list-item v-if="canDeleteAll" @click="deleteAllItem">
<v-list-item-icon>
<v-icon>$ayiTrashAlt</v-icon>
</v-list-item-icon>
@@ -889,30 +889,17 @@ export default {
},
unDeleteItem() {
this.value.items[this.activeItemIndex].deleted = false;
//CHILDREN
this.value.items[this.activeItemIndex].scheduledUsers.forEach(
z => (z.deleted = false)
);
//todo: other grandchildren
this.setDefaultView();
},
deleteItem() {
this.value.items[this.activeItemIndex].deleted = true;
//CHILDREN
this.value.items[this.activeItemIndex].scheduledUsers.forEach(
z => (z.deleted = true)
);
//todo: other grandchildren
this.setDefaultView();
this.$emit("change");
},
deleteAllItem() {
this.value.items.forEach(z => (z.deleted = true));
// //CHILDREN
// this.value.items[this.activeItemIndex].scheduledUsers.forEach(
// z => (z.deleted = true)
// );
//todo: other grandchildren
this.setDefaultView();
this.$emit("change");
},
@@ -1122,11 +1109,14 @@ and it's probably not a big list to fill anyway
);
},
canDelete: function() {
return this.activeItemIndex != null && this.canDeleteAll;
},
canDeleteAll: function() {
return (
this.activeItemIndex != null &&
!this.pvm.formState.readOnly &&
this.pvm.rights.change &&
this.pvm.subRights.items.delete
this.pvm.subRights.items.delete &&
this.hasData
);
},
canAddUnit: function() {