diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 12d87e15..3b222f88 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -399,7 +399,7 @@ bugubg: completely fresh workorder riddled with errors when attempting to create at AyaNova.Biz.WorkOrderBiz.TravelCreateAsync(WorkOrderItemTravel newObject) in C:\data\code\raven\server\AyaNova\biz\WorkOrderBiz.cs:line 4930 at AyaNova.Api.Controllers.WorkOrderController.PostWorkOrderItemTravel(WorkOrderItemTravel newObject, ApiVersion apiVersion) in C:\data\code\raven\server\AyaNova\Controllers\WorkOrderController.cs:line 1317 - tasks -> task field required but doesn't show required in UI + parts -> quantity required but doesn't show that in UI (no rule) labor -> error at server: 2021-06-11 11:45:46.3095|ERROR|SERVER|Error=>System.NullReferenceException: Object reference not set to an instance of an object. diff --git a/ayanova/src/components/work-order-item-parts.vue b/ayanova/src/components/work-order-item-parts.vue index 06612a07..41c3d4f3 100644 --- a/ayanova/src/components/work-order-item-parts.vue +++ b/ayanova/src/components/work-order-item-parts.vue @@ -152,6 +152,12 @@ `Items[${activeWoItemIndex}].parts[${activeItemIndex}].partId` ) " + :rules="[ + form().required( + this, + `Items[${activeWoItemIndex}].parts[${activeItemIndex}].partId` + ) + ]" @input=" fieldValueChanged( `Items[${activeWoItemIndex}].parts[${activeItemIndex}].partId` @@ -476,7 +482,7 @@ export default { userId: null, description: null, serials: null, - partId: null, + partId: 0, //deliberately zero to break rule on new partWarehouseId: 1, //important always default to "default" warehouse id 1 as even with inventory turned off it's required quantity: 1, taxPartSaleId: null, @@ -491,6 +497,15 @@ export default { this.$emit("change"); this.selectedRow = [{ index: newIndex }]; this.activeItemIndex = newIndex; + //trigger rule breaking / validation + this.$nextTick(() => { + this.value.items[this.activeWoItemIndex].parts[ + this.activeItemIndex + ].partId = null; + this.fieldValueChanged( + `Items[${this.activeWoItemIndex}].parts[${this.activeItemIndex}].partId` + ); + }); }, unDeleteItem() { this.value.items[this.activeWoItemIndex].parts[ diff --git a/ayanova/src/components/work-order-item-units.vue b/ayanova/src/components/work-order-item-units.vue index 2658d640..c4dffe30 100644 --- a/ayanova/src/components/work-order-item-units.vue +++ b/ayanova/src/components/work-order-item-units.vue @@ -280,7 +280,7 @@ export default { customFields: "{}", tags: [], userId: null, - unitId: 0, + unitId: 0,//zero to break rule on new estimatedQuantity: 0, startDate: null, stopDate: null,