diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt
index 2b3eb3ee..52c41edd 100644
--- a/ayanova/devdocs/todo.txt
+++ b/ayanova/devdocs/todo.txt
@@ -513,8 +513,6 @@ CURRENTLY DOING:
todo MISC:
- during Save of workorder it should not be available for entry as it can take some time to process and user could fuck off in the middle of it
- maybe a "Saving..." toast / popup and overlay to prevent fuckery??
Duplicate to self menu option in pm/wo/quote should prompt for attachments and wiki just like it does for the other types
I know this means another dialog, maybe need a single "Universal" type dialog instead on each of them and just push in the TO object type name
needed though for consistency and to give the option
diff --git a/ayanova/src/views/svc-pm.vue b/ayanova/src/views/svc-pm.vue
index b7b6b9ca..dc9a9692 100644
--- a/ayanova/src/views/svc-pm.vue
+++ b/ayanova/src/views/svc-pm.vue
@@ -32,13 +32,13 @@
-
+
-
+
- {{ $ay.t("DuplicateToWorkOrder") }}
+ {{ duplicateDlgTitle }}
- {{
+ {{
$ay.t("Cancel")
}}
- {{
- $ay.t("OK")
- }}
-
-
-
-
-
-
-
-
-
-
-
-
- {{ $ay.t("DuplicateToQuote") }}
-
-
-
-
-
-
- {{
- $ay.t("Cancel")
- }}
-
-
- {{
+ {{
$ay.t("OK")
}}
@@ -298,8 +265,9 @@ 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
- genWODlg: false,
- genQuoteDlg: false,
+ duplicateDlg: false,
+ duplicateDlgTitle: null,
+ duplicateTo: null, //"pm","wo" or "quote"
genCopyWiki: false,
genCopyAttachments: false
};
@@ -617,13 +585,48 @@ export default {
window.$gz.errorHandler.handleFormError(error, vm);
}
},
+ duplicateHandler() {
+ switch (this.duplicateTo) {
+ case "pm":
+ this.duplicate();
+ break;
+ case "wo":
+ this.generateWorkOrder();
+ break;
+ case "quote":
+ this.generateQuote();
+ break;
+ }
+ },
+
+ // duplicate() {
+ // //Navigate to new record
+ // this.$router.push({
+ // name: "pm-edit",
+ // params: {
+ // recordid: 0,
+ // obj: this.obj
+ // }
+ // });
+ // },
duplicate() {
+ 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.PM,
+ sId: this.obj.id
+ };
+ }
+ if (!this.genCopyWiki) {
+ cp.wiki = null; //already copied, need to remove it instead
+ }
//Navigate to new record
this.$router.push({
name: "pm-edit",
params: {
recordid: 0,
- obj: this.obj
+ obj: cp
}
});
},
@@ -1698,13 +1701,19 @@ async function clickHandler(menuItem) {
});
break;
case "genwo":
- m.vm.genWODlg = true;
+ m.vm.duplicateDlgTitle = m.vm.$ay.t("DuplicateToWorkOrder");
+ m.vm.duplicateTo = "wo";
+ m.vm.duplicateDlg = true;
break;
case "genquote":
- m.vm.genQuoteDlg = true;
+ m.vm.duplicateDlgTitle = m.vm.$ay.t("DuplicateToQuote");
+ m.vm.duplicateTo = "quote";
+ m.vm.duplicateDlg = true;
break;
case "duplicate":
- m.vm.duplicate();
+ m.vm.duplicateDlgTitle = m.vm.$ay.t("DuplicateToPM");
+ m.vm.duplicateTo = "pm";
+ m.vm.duplicateDlg = true;
break;
case "report":
if (m.id != null) {