diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 07e2f84c..50bbea1c 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -856,4 +856,4 @@ BUILD 117 Quote has it's own status system like workorder does but separate and not related to wo (case 3628, also a customer requested feature on that case) this is a change from v7 where the status for quotes was built in and fixed, now it's user settable same as wo status Option to bring over wiki and attachments to wo when generated from generate wo menu item in quote (case 3178 for attachments, customer requested) - +- Workorder "Quote parent" menu item to be able to open the quote that generated the workorder from the workorder if applicable (also does PM but not coded pm's yet at this writing) diff --git a/ayanova/src/views/svc-workorder.vue b/ayanova/src/views/svc-workorder.vue index a83d4239..db8aa809 100644 --- a/ayanova/src/views/svc-workorder.vue +++ b/ayanova/src/views/svc-workorder.vue @@ -35,6 +35,72 @@ :size="60" > + + + + + + + + @@ -243,7 +309,11 @@ export default { }, lastGetContractId: -1, //note: -1 so that a new record updates lastGetCustomerId: -1, - goto: null //{type:ayatype,id:wodescendant id} picked up by woitem when set non-null to trigger navigate to the item in question + goto: null, //{type:ayatype,id:wodescendant id} picked up by woitem when set non-null to trigger navigate to the item in question + genPMDlg: false, + genQuoteDlg: false, + genCopyWiki: false, + genCopyAttachments: false }; }, //WATCHERS @@ -613,6 +683,60 @@ export default { } }); }, + generateQuote() { + let cp = JSON.parse(JSON.stringify(this.obj)); + if (this.genCopyAttachments) { + //this property set will trigger server to copy attachments + cp.genCopyAttachmentsFrom = { + sAType: window.$gz.type.WorkOrder, + sId: this.obj.id + }; + } + if (!this.genCopyWiki) { + cp.wiki = null; //already copied, need to remove it instead + } + cp.states = []; + cp.items.forEach(x => { + x.partRequests = []; + }); + cp.id = 0; + + //Navigate to new record + this.$router.push({ + name: "quote-edit", + params: { + recordid: 0, + obj: cp + } + }); + }, + generatePM() { + let cp = JSON.parse(JSON.stringify(this.obj)); + if (this.genCopyAttachments) { + //this property set will trigger server to copy attachments + cp.genCopyAttachmentsFrom = { + sAType: window.$gz.type.WorkOrder, + sId: this.obj.id + }; + } + if (!this.genCopyWiki) { + cp.wiki = null; //already copied, need to remove it instead + } + cp.states = []; + cp.items.forEach(x => { + x.partRequests = []; + }); + cp.id = 0; + + //Navigate to new record + this.$router.push({ + name: "pm-edit", + params: { + recordid: 0, + obj: cp + } + }); + }, ///////////////////////////////////////////////////////// // Clean woitem and children so it's // savable as a new record @@ -1719,6 +1843,12 @@ async function clickHandler(menuItem) { params: { recordid: 0 } }); break; + case "genpm": + m.vm.genPMDlg = true; + break; + case "genquote": + m.vm.genQuoteDlg = true; + break; case "duplicate": m.vm.duplicate(); break; @@ -1868,6 +1998,32 @@ function generateMenu(vm) { }); } + if ( + vm.rights.change && + vm.$route.params.recordid != 0 && + !vm.obj.userIsRestrictedType + ) { + menuOptions.menuItems.push({ + title: "GenerateQuote", + icon: "$ayiPencilAlt", + key: FORM_KEY + ":genquote", + vm: vm + }); + } + + if ( + vm.rights.change && + vm.$route.params.recordid != 0 && + !vm.obj.userIsRestrictedType + ) { + menuOptions.menuItems.push({ + title: "GeneratePM", + icon: "$ayiBusinessTime", + key: FORM_KEY + ":genpm", + vm: vm + }); + } + if ( vm.rights.change && vm.$route.params.recordid != 0 && @@ -2194,7 +2350,9 @@ async function fetchTranslatedText(vm) { "ApplyUnitContract", "WorkOrderFromQuoteID", "WorkOrderFromPMID", - "CustomerServiceRequest" + "CustomerServiceRequest", + "GenerateQuote", + "GeneratePM" ]); }