This commit is contained in:
2021-07-15 19:33:01 +00:00
parent 3240bf83f6
commit 4a38315e8b
15 changed files with 30 additions and 207 deletions

View File

@@ -61,8 +61,7 @@
</v-col>
<v-col
v-if="
pvm.subRights.states.visible &&
form().showMe(this, 'WorkOrderStatus') &&
form().showMe(this, 'WorkOrderStatus') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted

View File

@@ -785,21 +785,13 @@ export default {
return this.activeItemIndex != null;
},
canAdd: function() {
return this.pvm.rights.change && this.pvm.subRights.expenses.create;
return this.pvm.rights.change;
},
canDelete: function() {
return (
this.activeItemIndex != null &&
this.pvm.rights.change &&
this.pvm.subRights.expenses.delete
);
return this.activeItemIndex != null && this.pvm.rights.change;
},
canDeleteAll: function() {
return (
this.pvm.rights.change &&
this.pvm.subRights.expenses.delete &&
!this.value.userIsRestrictedType
);
return this.pvm.rights.change && !this.value.userIsRestrictedType;
}
}
};

View File

@@ -983,21 +983,13 @@ export default {
return this.activeItemIndex != null;
},
canAdd: function() {
return this.pvm.rights.change && this.pvm.subRights.labors.create;
return this.pvm.rights.change;
},
canDelete: function() {
return (
this.activeItemIndex != null &&
this.pvm.rights.change &&
this.pvm.subRights.labors.delete
);
return this.activeItemIndex != null && this.pvm.rights.change;
},
canDeleteAll: function() {
return (
this.pvm.rights.change &&
this.pvm.subRights.labors.delete &&
!this.value.userIsRestrictedType
);
return this.pvm.rights.change && !this.value.userIsRestrictedType;
}
//----
}

View File

@@ -866,11 +866,7 @@ export default {
return this.activeItemIndex != null;
},
canAdd: function() {
return (
this.pvm.rights.change &&
this.pvm.subRights.loans.create &&
!this.value.userIsRestrictedType
);
return this.pvm.rights.change && !this.value.userIsRestrictedType;
},
canDelete: function() {
return (
@@ -880,11 +876,7 @@ export default {
);
},
canDeleteAll: function() {
return (
this.pvm.rights.change &&
this.pvm.subRights.loans.delete &&
!this.value.userIsRestrictedType
);
return this.pvm.rights.change && !this.value.userIsRestrictedType;
}
//----

View File

@@ -1079,11 +1079,7 @@ export default {
return this.activeItemIndex != null;
},
canAdd: function() {
return (
this.pvm.rights.change &&
this.pvm.subRights.outsideServices.create &&
!this.value.userIsRestrictedType
);
return this.pvm.rights.change && !this.value.userIsRestrictedType;
},
canDelete: function() {
return (
@@ -1093,11 +1089,7 @@ export default {
);
},
canDeleteAll: function() {
return (
this.pvm.rights.change &&
this.pvm.subRights.outsideServices.delete &&
!this.value.userIsRestrictedType
);
return this.pvm.rights.change && !this.value.userIsRestrictedType;
}
//----

View File

@@ -381,9 +381,7 @@ export default {
hasSelection: function() {
return this.activeItemIndex != null;
},
// canAdd: function() {
// return this.pvm.rights.change && this.pvm.subRights.partRequests.create && !this.value.userIsRestrictedType;
// },
canDelete: function() {
return (
this.activeItemIndex != null &&
@@ -392,11 +390,7 @@ export default {
);
},
canDeleteAll: function() {
return (
this.pvm.rights.change &&
this.pvm.subRights.partRequests.delete &&
!this.value.userIsRestrictedType
);
return this.pvm.rights.change && !this.value.userIsRestrictedType;
}
//----

View File

@@ -1110,11 +1110,7 @@ export default {
return this.activeItemIndex != null;
},
canAdd: function() {
return (
this.pvm.rights.change &&
this.pvm.subRights.parts.create &&
!this.value.userIsRestrictedType
);
return this.pvm.rights.change && !this.value.userIsRestrictedType;
},
canDelete: function() {
return (
@@ -1124,11 +1120,7 @@ export default {
);
},
canDeleteAll: function() {
return (
this.pvm.rights.change &&
this.pvm.subRights.parts.delete &&
!this.value.userIsRestrictedType
);
return this.pvm.rights.change && !this.value.userIsRestrictedType;
}
//----

View File

@@ -670,11 +670,7 @@ export default {
return this.activeItemIndex != null;
},
canAdd: function() {
return (
this.pvm.rights.change &&
this.pvm.subRights.scheduledUsers.create &&
!this.value.userIsRestrictedType
);
return this.pvm.rights.change && !this.value.userIsRestrictedType;
},
canDelete: function() {
return (
@@ -684,11 +680,7 @@ export default {
);
},
canDeleteAll: function() {
return (
this.pvm.rights.change &&
this.pvm.subRights.scheduledUsers.delete &&
!this.value.userIsRestrictedType
);
return this.pvm.rights.change && !this.value.userIsRestrictedType;
}
}
};

View File

@@ -627,11 +627,7 @@ export default {
return this.activeItemIndex != null;
},
canAdd: function() {
return (
this.pvm.rights.change &&
this.pvm.subRights.tasks.create &&
!this.value.userIsRestrictedType
);
return this.pvm.rights.change && !this.value.userIsRestrictedType;
},
canDelete: function() {
return (
@@ -641,11 +637,7 @@ export default {
);
},
canDeleteAll: function() {
return (
this.pvm.rights.change &&
this.pvm.subRights.tasks.delete &&
!this.value.userIsRestrictedType
);
return this.pvm.rights.change && !this.value.userIsRestrictedType;
}
}
};

View File

@@ -961,21 +961,13 @@ export default {
return this.activeItemIndex != null;
},
canAdd: function() {
return this.pvm.rights.change && this.pvm.subRights.travels.create;
return this.pvm.rights.change;
},
canDelete: function() {
return (
this.activeItemIndex != null &&
this.pvm.rights.change &&
this.pvm.subRights.travels.delete
);
return this.activeItemIndex != null && this.pvm.rights.change;
},
canDeleteAll: function() {
return (
this.pvm.rights.change &&
this.pvm.subRights.travels.delete &&
!this.value.userIsRestrictedType
);
return this.pvm.rights.change && !this.value.userIsRestrictedType;
}
//----

View File

@@ -788,11 +788,7 @@ export default {
return this.activeItemIndex != null;
},
canAdd: function() {
return (
this.pvm.rights.change &&
this.pvm.subRights.units.create &&
!this.value.userIsRestrictedType
);
return this.pvm.rights.change && !this.value.userIsRestrictedType;
},
canDelete: function() {
return (
@@ -802,11 +798,7 @@ export default {
);
},
canDeleteAll: function() {
return (
this.pvm.rights.change &&
this.pvm.subRights.units.delete &&
!this.value.userIsRestrictedType
);
return this.pvm.rights.change && !this.value.userIsRestrictedType;
}
}
};

View File

@@ -1267,8 +1267,7 @@ and it's probably not a big list to fill anyway
return (
!this.pvm.formState.readOnly &&
!this.value.userIsRestrictedType &&
this.pvm.rights.change &&
this.pvm.subRights.items.create
this.pvm.rights.change
);
},
canDelete: function() {
@@ -1282,21 +1281,18 @@ and it's probably not a big list to fill anyway
return (
!this.pvm.formState.readOnly &&
this.pvm.rights.change &&
this.pvm.subRights.items.delete &&
this.hasData &&
!this.value.userIsRestrictedType
);
},
canAddUnit: function() {
return (
this.pvm.subRights.units.create &&
this.form().showMe(this, "WorkOrderItemUnitList") &&
!this.value.userIsRestrictedType
);
},
showUnits: function() {
return (
this.pvm.subRights.units.visible &&
this.form().showMe(this, "WorkOrderItemUnitList") &&
this.value.items[this.activeItemIndex].units.length > 0 &&
!this.value.userIsSubContractorRestricted
@@ -1304,42 +1300,36 @@ and it's probably not a big list to fill anyway
},
canAddScheduledUser: function() {
return (
this.pvm.subRights.scheduledUsers.create &&
this.form().showMe(this, "WorkOrderItemScheduledUserList") &&
!this.value.userIsRestrictedType
);
},
showScheduledUsers: function() {
return (
this.pvm.subRights.scheduledUsers.visible &&
this.form().showMe(this, "WorkOrderItemScheduledUserList") &&
this.value.items[this.activeItemIndex].scheduledUsers.length > 0
);
},
canAddTask: function() {
return (
this.pvm.subRights.tasks.create &&
this.form().showMe(this, "WorkOrderItemTasks") &&
!this.value.userIsRestrictedType
);
},
showTasks: function() {
return (
this.pvm.subRights.tasks.visible &&
this.form().showMe(this, "WorkOrderItemTasks") &&
this.value.items[this.activeItemIndex].tasks.length > 0
);
},
canAddPart: function() {
return (
this.pvm.subRights.parts.create &&
this.form().showMe(this, "WorkOrderItemPartList") &&
!this.value.userIsRestrictedType
);
},
showParts: function() {
return (
this.pvm.subRights.parts.visible &&
this.form().showMe(this, "WorkOrderItemPartList") &&
this.value.items[this.activeItemIndex].parts.length > 0 &&
!this.value.userIsSubContractorRestricted
@@ -1349,41 +1339,31 @@ and it's probably not a big list to fill anyway
return (
this.pvm.useInventory &&
this.value.items[this.activeItemIndex].partRequests.length > 0 &&
this.pvm.subRights.partRequests.visible &&
this.form().showMe(this, "WorkOrderItemPartRequestList") &&
!this.value.userIsSubContractorRestricted
);
},
canAddLabor: function() {
return (
this.pvm.subRights.labors.create &&
this.form().showMe(this, "WorkOrderItemLaborList")
);
return this.form().showMe(this, "WorkOrderItemLaborList");
},
showLabors: function() {
return (
this.pvm.subRights.labors.visible &&
this.form().showMe(this, "WorkOrderItemLaborList") &&
this.value.items[this.activeItemIndex].labors.length > 0
);
},
canAddTravel: function() {
return (
this.pvm.subRights.travels.create &&
this.form().showMe(this, "WorkOrderItemTravelList")
);
return this.form().showMe(this, "WorkOrderItemTravelList");
},
showTravels: function() {
return (
this.pvm.subRights.travels.visible &&
this.form().showMe(this, "WorkOrderItemTravelList") &&
this.value.items[this.activeItemIndex].travels.length > 0
);
},
canAddExpense: function() {
return (
this.pvm.subRights.expenses.create &&
this.form().showMe(this, "WorkOrderItemExpenseList") &&
!this.value.userIsSubContractorFull &&
!this.value.userIsSubContractorRestricted
@@ -1391,7 +1371,6 @@ and it's probably not a big list to fill anyway
},
showExpenses: function() {
return (
this.pvm.subRights.expenses.visible &&
this.form().showMe(this, "WorkOrderItemExpenseList") &&
this.value.items[this.activeItemIndex].expenses.length > 0 &&
!this.value.userIsSubContractorFull &&
@@ -1400,14 +1379,12 @@ and it's probably not a big list to fill anyway
},
canAddLoan: function() {
return (
this.pvm.subRights.loans.create &&
this.form().showMe(this, "WorkOrderItemLoanList") &&
!this.value.userIsRestrictedType
);
},
showLoans: function() {
return (
this.pvm.subRights.loans.visible &&
this.form().showMe(this, "WorkOrderItemLoanList") &&
this.value.items[this.activeItemIndex].loans.length > 0 &&
!this.value.userIsSubContractorRestricted
@@ -1415,14 +1392,12 @@ and it's probably not a big list to fill anyway
},
canAddOutsideService: function() {
return (
this.pvm.subRights.outsideServices.create &&
this.form().showMe(this, "WorkOrderItemOutsideServiceList") &&
!this.value.userIsRestrictedType
);
},
showOutsideServices: function() {
return (
this.pvm.subRights.outsideServices.visible &&
this.form().showMe(this, "WorkOrderItemOutsideServiceList") &&
this.value.items[this.activeItemIndex].outsideServices.length > 0 &&
!this.value.userIsRestrictedType

View File

@@ -267,7 +267,7 @@ export default {
},
canAdd: function() {
//first check most obvious disqualifying properties
if (!this.pvm.rights.change || !this.pvm.subRights.states.create) {
if (!this.pvm.rights.change) {
return false;
}

View File

@@ -220,7 +220,7 @@ export default {
appError: null,
serverError: {}
},
rights: window.$gz.role.defaultRightsObject(), //overall workorder rights, supersedes subrights
rights: window.$gz.role.defaultRightsObject(),
ayaType: window.$gz.type.WorkOrder,
currencyName: window.$gz.locale.getCurrencyName(),
timeZoneName: window.$gz.locale.getResolvedTimeZoneName(),
@@ -235,79 +235,6 @@ export default {
woItemTaskCompletionTypes: [],
loanUnitRateUnits: []
},
subRights: {
items: {
visible: true,
create: true,
change: true,
delete: true
},
states: {
visible: true,
create: true, //no change, only create it's write only
delete: true
},
labors: {
visible: true,
create: true,
change: true,
delete: true
},
parts: {
visible: true,
create: true,
change: true,
delete: true
},
partRequests: {
visible: true,
create: true,
change: true,
delete: true
},
expenses: {
visible: true,
create: true,
change: true,
delete: true
},
loans: {
visible: true,
create: true,
change: true,
delete: true
},
scheduledUsers: {
visible: true,
create: true,
change: true,
delete: true
},
tasks: {
visible: true,
create: true,
change: true,
delete: true
},
travels: {
visible: true,
create: true,
change: true,
delete: true
},
units: {
visible: true,
create: true,
change: true,
delete: true
},
outsideServices: {
visible: true,
create: true,
change: true,
delete: true
}
},
maxTableNotesLength: 50, //value to cut off notes in tables
saveResult: {
fatal: false, //fatal error, further save is pointless, bail early and report