This commit is contained in:
2021-07-19 23:05:31 +00:00
parent 97df26f982
commit 1256466385
5 changed files with 68 additions and 127 deletions

View File

@@ -423,11 +423,10 @@ todo: many biz objects are not using new PUT methodology
CURRENTLY DOING: more misc stuff below to complete workorder!!!
todo: Unit and contract on workorder
one contracted unit per workorder only
set contract when unit added, overrides anything previously (but only if it passes validation check above)
todo: units on work order are not limited to customer on work order??
make single unit picklist current customer only variant
TODO 1: Test address / units select alternate when have units working
@@ -1183,125 +1182,8 @@ MID CENTURY MODERN TUNES - https://www.allmusic.com/album/ultra-lounge-vol-14-bo
BUILD CHANGES OF NOTE
BUILD 115
BUILD 116
- "WorkOrder" changed to "Work order" in all English translation keys that displayed it
- Customer edit form "Work orders" menu item implemented to show all workorders list filtered by customer (replicates the "Show All" workorders feature from v7)
- Unit edit form "Work orders" menu item implemented to show all WorkOrderItemUnit list filtered by unit (replicates the "Show All" workorders feature from v7)
- Loan unit edit form "Work orders" menu item implemented to show all WorkOrderItemLoan list filtered by loan unit (replicates the "Show All" workorders feature from v7)
- Project edit form "Work orders" menu item implemented to show all WorkOrders list filtered by project (new feature)
- Part edit form "Work orders" menu item implemented to show all WorkOrderItemParts list filtered by part (new feature)
- User edit form "Scheduled Users" and "Labors" menu items implemented to show all workorderitem scheduled user and workorderitemlabor lists filtered by User (new feature)
- Dashboard form "Scheduled Users" and "Labors" menu items implemented to show all workorderitem scheduled user and workorderitemlabor lists filtered by current User (new feature)
- Translation roles: changed "Limited" to "Restricted" to more properly reflect what it means and also in all translations which translate more accurately this way
- Transtlation roles: removed "- full" from full rights roles
i.e. "Inventory - Full" is now just "Inventory"
- Role object and Translation: renamed "Dispatch" roles to "Service" roles as "Dispatch" is a sub-set of all Service manager tasks and roles
i.e. "Dispatch", "Dispatch - restricted" now "Service", "Service - restricted"
this also ties in more tightly with the user interface menu options making it clearer where it applies
- Work order scheduled user, labor and travel NEW record code now checks if current logged in user is a scheduleable type user and automatically selects them as the user id in those records when they are created
* Sub contractors / Technician - Restricted users and Work Orders
If a User is set to User type of Sub contractor or if they are a Service type user and are assigned the "Technician - Restricted" role then special limitations apply to them when using the work order form:
* Work order *Item* restrictions
* Theser Users will only be able to access the Work order Items for which they are Scheduled in the work order editing form. In other words if you do not want a Sub contractor or tech - restricted user to see parts of a work order do not add them to the Scheduled users collection on those work order items
WORK ORDER RESTRICTIONS ADDED:
* Work order Cost field restrictions
*Work orders can show Costs for various items on them but these costs are only displayed for a select few users:
* Non staff user types (customer headoffice or subcontractor) can not see costs at all no matter what roles are set for them
* WorkOrderItemParts costs: to see these costs, the user must have one of the following roles: InventoryRestricted, Inventory, BizAdmin (full), Accounting
* WorkOrderItemLabor / WorkOrderItemTravel / WorkOrderItemLoan costs: user must have one of the following roles: ServiceRestricted, Service, BizAdmin (full), Accounting
* Costs to restricted users are not only hidden in work order user interface but are also sent as zeros in the data from the server
* Cost restrictions also apply to reporting so a report with cost fields on it will show those values as zero if the current user is restricted from seeing costs
## Sub contractors / Technician - Restricted users and Work Orders
If a User is set to User type of Sub contractor or if they are a Service type user and are assigned the "Technician - Restricted" role then special limitations apply to them:
* Service -> Work order list navigation pane area
* These restricted Users are not shown the option of viewing the full work order list. They will access their work orders via their Home -> Schedule form
* Work order main menu
* limited to Report, Save and Help options only
* Work order / work order item can not be created or deleted
* Work order *Item* restrictions
* These restricted Users will only be able to access the Work order Items for which they are Scheduled in the work order editing form. In other words if you do not want a Sub contractor or tech - restricted user to see parts of a Work order do not add them to the Scheduled users collection on those work order items
* Reporting convenience field: IsCompleteRecord field is included with the report header data to indicate if any items were removed due to restricted user
* No fields available in Work order item section other than to view but not edit the Sequence, Summary and Technotes fields
* "Tech - Limited" User role specific restrictions
* All restrictions listed above in Work order *Item* restrictions plus:
* All work order header fields visible but not editable other than work order status which has a separately configurable role restriction setting (including attachments, wiki and tags)
* Form main menu items available: none except for Report which has a separately configurable role restriction setting
* Tasks: view and edit existing tasks, set completion type and date only, no add or remove or changing other fields
* Scheduled Users: view only where they are the selected User and convert to labor record
* Labors: add (no user selection defaults to themselves), remove, view and edit only when they are the selected User
* Travels: add (no user selection defaults to themselves), remove, view and edit only when they are the selected User
* Units: view only and limited to fields to identify unit
* Parts: view only and limited to fields to identify part
* Part requests: view only
* Expenses: add (no user selection defaults to themselves), view, partial fields available to edit or delete only where they are the selected user and only edit fields Summary, Cost, Tax paid, Description
* Loans: view only and limited fields to identify unit and dates
* Outside services: Not available
* "Sub contractor" User type user role specific restrictions
* All restrictions listed above in Work order *Item* restrictions plus:
* No work order header fields visible except for Customer name, Customer contact name and service address
* Form main menu items available: none except for Report which has a separately configurable role restriction setting
* Tasks: view and edit existing tasks, set completion type and date only, no add or remove or changing other fields
* Scheduled Users: view only where they are the selected User and convert to labor record
* Labors: add (no user selection defaults to themselves), remove, view and edit only when they are the selected User
* Travels: add (no user selection defaults to themselves), remove, view and edit only when they are the selected User
* Units: view only and limited to fields to identify unit
* Parts: view only and limited to fields to identify part
* Part requests: view only
* Expenses: Not available
* Loans: view only and limited fields to identify unit and dates
* Outside services: Not available
* "Sub contractor - restricted" User type specific restrictions
* All restrictions listed above in Work order *Item* restrictions plus:
* No work order header fields visible except for Customer name and Customer contact name
* Form main menu items available: none except for Report which has a separately configurable role restriction setting
* Tasks: view and edit existing tasks, set completion type and date only, no add or remove or changing other fields
* Scheduled Users: view only where they are the selected User and convert to labor record
* Labors: add (no user selection defaults to themselves), remove, view and edit only when they are the selected User
* Travels: add (no user selection defaults to themselves), remove, view and edit only when they are the selected User
* Units: Not available
* Parts: Not available
* Part requests: Not available
* Expenses: Not available
* Loans: Not available
* Outside services: Not available
### Restricted work order User report fields
As some Work order data is not shown or available to restricted Users, several flag fields are provided in the work order header which are available to use in Report templates as required:
* IsCompleteRecord - false if some Work order Item records were removed as not available to current restricted user
* UserIsRestrictedType
* UserIsTechRestricted
* UserIsSubContractorFull
* UserIsSubContractorRestricted
* UserCanViewPartCosts
* UserCanViewLaborOrTravelRateCosts
* UserCanViewLoanerCosts
- Seeding work order data, fixed so no longer uses Customer users as techs on work order and ensure that known scheduleable type users that are listed in the evaluation login page appear on plenty of work orders as scheduled user
for testing and ultimately evaluation so that when user logs in as one of the sample users they see relevant data
- Seeding work order status, changed roles so more realistic, was just random test roles before
- Report template editor - changed translation key for Roles to "Who can select" to mirror Work order status terminology and more clearly indicate what it means
- Report templates list - added Select roles as available column
- Work order status data list - added Select roles and Remove roles as default and available columns
- Main data list control: tweaked the column header filter button layout to be slightly more to the right
so that lists like report templates that don't have a selector don't push the filter button slightly off the page to the left
- Work order Unit Contract: added code to handle Unit with contract on work order. Originally was going to apply automatically at server but this would cause many secondary issues, so instead opted to prompt user and set at client end instead.
see help docs for details
Note: you made a case for this case 114, please remove it once you confirm it's resolved (and any other "testing issue" cases that are resolved as well)

View File

@@ -152,6 +152,17 @@ export default {
noButtonText: window.$gz.translation.get("Cancel"),
type: ttype
});
},
/////////////////////////////////////
// Custom confirmation pre-translated
//
confirmGenericPreTranslated(msg, ttype = "info") {
return VM_LOCAL.$root.$gzconfirm({
message: msg,
yesButtonText: window.$gz.translation.get("OK"),
noButtonText: window.$gz.translation.get("Cancel"),
type: ttype
});
}
//new functions above here

View File

@@ -16,6 +16,9 @@
<template v-if="options.type == 'info'">
<v-icon large color="info">$ayiInfoCircle</v-icon>
</template>
<template v-if="options.type == 'question'">
<v-icon large color="info">$ayiQuestionCircle</v-icon>
</template>
<template v-if="options.type == 'warning'">
<v-icon large color="warning">$ayiExclamationCircle</v-icon>
</template>
@@ -74,7 +77,7 @@ export default {
message: null,
yesButtonText: null,
noButtonText: null,
type: "info" //one of success, info, warning, and error, see v-alert docs for more info
type: "info" //one of success, info, question, warning, and error, see v-alert docs for more info
}
}),
methods: {

View File

@@ -404,6 +404,49 @@ export default {
}
},
methods: {
async updateContractIfApplicable() {
const id = this.value.items[this.activeWoItemIndex].units[
this.activeItemIndex
].unitId;
if (!id || id == 0) {
return;
}
let res = await window.$gz.api.get(`unit/active-contract/${id}`);
if (res.error) {
window.$gz.eventBus.$emit(
"notify-warning",
window.$gz.errorHandler.errorToString(res, this)
);
} else {
if (res.data.id == 0) {
//no contract, just bail
return;
}
//has contract, if it differs from main work order contract then offer to set it
if (res.data.id == this.value.contractId) {
//same contract, just bail
//yes the date could not be different but we're not going to pick that nit, they can just unset and set if it matters
return;
}
//Prompt user to use new contract
const prompt = this.$ay
.t("ApplyUnitContract")
.replace("{0}", res.data.name);
let dialogResult = await window.$gz.dialog.confirmGenericPreTranslated(
prompt,
"question"
);
if (dialogResult == false) {
return;
} else {
this.value.contractId = res.data.id;
this.value.isDirty = true;
this.pvm.formState.dirty = true;
this.$emit("change");
}
}
},
async getWarrantyInfo() {
this.warrantyInfo = null;
@@ -556,13 +599,14 @@ export default {
}
this.bulkUnitsDialog = false;
},
unitChange(newName) {
async unitChange(newName) {
this.value.items[this.activeWoItemIndex].units[
this.activeItemIndex
].unitViz = newName;
this.value.items[this.activeWoItemIndex].units[
this.activeItemIndex
].warrantyViz = null;
await this.updateContractIfApplicable();
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].units.length;

View File

@@ -2129,7 +2129,8 @@ async function fetchTranslatedText(vm) {
"UnitPurchasedDate",
"UnitReceipt",
"RecentWorkOrders",
"WorkOrderGenerateUnit"
"WorkOrderGenerateUnit",
"ApplyUnitContract"
]);
}