diff --git a/ayanova/src/api/open-object-handler.js b/ayanova/src/api/open-object-handler.js index 54febf94..c37d807d 100644 --- a/ayanova/src/api/open-object-handler.js +++ b/ayanova/src/api/open-object-handler.js @@ -54,6 +54,7 @@ export default { } } else { switch (tid.type) { + //### WORKORDER AND RELATIVES ####### case ayatype.WorkOrderItem: case ayatype.WorkOrderItemExpense: case ayatype.WorkOrderItemLabor: @@ -98,6 +99,52 @@ export default { params: { recordid: tid.id, gotype: tid.gotype, goid: tid.goid } }); break; + //### QUOTE AND RELATIVES ### + case ayatype.QuoteItem: + case ayatype.QuoteItemExpense: + case ayatype.QuoteItemLabor: + case ayatype.QuoteItemLoan: + case ayatype.QuoteItemOutsideService: + case ayatype.QuoteItemPart: + case ayatype.QuoteItemPartRequest: + case ayatype.QuoteItemScheduledUser: + case ayatype.QuoteItemTask: + case ayatype.QuoteItemTravel: + case ayatype.QuoteItemUnit: + (async () => { + try { + let res = await window.$gz.api.get( + `search/ancestor/${tid.type}/${tid.id}` + ); + + if (res.error) { + throw new Error( + window.$gz.errorHandler.errorToString(res, vm) + ); + } + if (res.data.id && res.data.id != 0) { + this.handleOpenObjectClick(vm, { + type: ayatype.Quote, + id: res.data.id, + gotype: tid.type, + goid: tid.id + }); + return; + } + } catch (e) { + //throw new Error(e); + throw new Error(window.$gz.errorHandler.errorToString(e, vm)); + } + })(); + + break; + case ayatype.Quote: + vm.$router.push({ + name: "quote-edit", + params: { recordid: tid.id, gotype: tid.gotype, goid: tid.goid } + }); + break; + case ayatype.Memo: vm.$router.push({ name: "memo-edit",