This commit is contained in:
2021-08-05 19:59:19 +00:00
parent 8b291ed6a1
commit 5dbbeb15f6
2 changed files with 56 additions and 47 deletions

View File

@@ -672,6 +672,7 @@ export default {
cp.wiki = null; //already copied, need to remove it instead cp.wiki = null; //already copied, need to remove it instead
} }
cp.states = []; cp.states = [];
cp.lastStatusId = undefined;
cp.items.forEach(x => { cp.items.forEach(x => {
x.partRequests = []; x.partRequests = [];
}); });

View File

@@ -31,15 +31,14 @@
<v-overlay :value="!formState.ready || formState.loading"> <v-overlay :value="!formState.ready || formState.loading">
<v-progress-circular indeterminate :size="64" /> <v-progress-circular indeterminate :size="64" />
</v-overlay> </v-overlay>
<!-- </template> -->
<!-- ################################################################################--> <!-- ################################################################################-->
<!-- ########################## GENERATE QUOTE DIALOG ###############################--> <!-- ########################## DUPLICATE DIALOG ###############################-->
<!-- ################################################################################--> <!-- ################################################################################-->
<template> <template>
<v-row justify="center"> <v-row justify="center">
<v-dialog persistent max-width="600px" v-model="genQuoteDlg"> <v-dialog persistent max-width="600px" v-model="duplicateDlg">
<v-card> <v-card>
<v-card-title>{{ $ay.t("DuplicateToQuote") }}</v-card-title> <v-card-title>{{ duplicateDlgTitle }}</v-card-title>
<v-card-text> <v-card-text>
<v-checkbox <v-checkbox
v-model="genCopyWiki" v-model="genCopyWiki"
@@ -52,45 +51,12 @@
></v-checkbox> ></v-checkbox>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-btn text @click="genQuoteDlg = false" color="primary">{{ <v-btn text @click="duplicateDlg = false" color="primary">{{
$ay.t("Cancel") $ay.t("Cancel")
}}</v-btn> }}</v-btn>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-btn color="primary" text @click="generateQuote()">{{ <v-btn color="primary" text @click="duplicateHandler()">{{
$ay.t("OK")
}}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-row>
</template>
<!-- ################################################################################-->
<!-- ########################## GENERATE PM DIALOG ###############################-->
<!-- ################################################################################-->
<template>
<v-row justify="center">
<v-dialog persistent max-width="600px" v-model="genPMDlg">
<v-card>
<v-card-title>{{ $ay.t("DuplicateToPM") }}</v-card-title>
<v-card-text>
<v-checkbox
v-model="genCopyWiki"
:label="$ay.t('CopyWiki')"
></v-checkbox>
<v-checkbox
v-model="genCopyAttachments"
:label="$ay.t('CopyAttachments')"
></v-checkbox>
</v-card-text>
<v-card-actions>
<v-btn text @click="genPMDlg = false" color="primary">{{
$ay.t("Cancel")
}}</v-btn>
<v-spacer></v-spacer>
<v-btn color="primary" text @click="generatePM()">{{
$ay.t("OK") $ay.t("OK")
}}</v-btn> }}</v-btn>
</v-card-actions> </v-card-actions>
@@ -306,8 +272,9 @@ export default {
lastGetContractId: -1, //note: -1 so that a new record updates lastGetContractId: -1, //note: -1 so that a new record updates
lastGetCustomerId: -1, 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, duplicateDlg: false,
genQuoteDlg: false, duplicateDlgTitle: null,
duplicateTo: null, //"pm","wo" or "quote"
genCopyWiki: false, genCopyWiki: false,
genCopyAttachments: false genCopyAttachments: false
}; };
@@ -669,13 +636,47 @@ export default {
window.$gz.errorHandler.handleFormError(error, vm); window.$gz.errorHandler.handleFormError(error, vm);
} }
}, },
// duplicate() {
// //Navigate to new record
// this.$router.push({
// name: "workorder-edit",
// params: {
// recordid: 0,
// obj: this.obj
// }
// });
// },
duplicateHandler() {
switch (this.duplicateTo) {
case "pm":
this.generatePM();
break;
case "wo":
this.duplicate();
break;
case "quote":
this.generateQuote();
break;
}
},
duplicate() { 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.WorkOrder,
sId: this.obj.id
};
}
if (!this.genCopyWiki) {
cp.wiki = null; //already copied, need to remove it instead
}
//Navigate to new record //Navigate to new record
this.$router.push({ this.$router.push({
name: "workorder-edit", name: "workorder-edit",
params: { params: {
recordid: 0, recordid: 0,
obj: this.obj obj: cp
} }
}); });
}, },
@@ -692,6 +693,7 @@ export default {
cp.wiki = null; //already copied, need to remove it instead cp.wiki = null; //already copied, need to remove it instead
} }
cp.states = []; cp.states = [];
cp.lastStatusId = undefined;
cp.items.forEach(x => { cp.items.forEach(x => {
x.partRequests = []; x.partRequests = [];
}); });
@@ -1858,14 +1860,20 @@ async function clickHandler(menuItem) {
params: { recordid: 0 } params: { recordid: 0 }
}); });
break; break;
case "genpm": case "duplicate":
m.vm.genPMDlg = true; m.vm.duplicateDlgTitle = m.vm.$ay.t("DuplicateToWorkOrder");
m.vm.duplicateTo = "wo";
m.vm.duplicateDlg = true;
break; break;
case "genquote": case "genquote":
m.vm.genQuoteDlg = true; m.vm.duplicateDlgTitle = m.vm.$ay.t("DuplicateToQuote");
m.vm.duplicateTo = "quote";
m.vm.duplicateDlg = true;
break; break;
case "duplicate": case "genpm":
m.vm.duplicate(); m.vm.duplicateDlgTitle = m.vm.$ay.t("DuplicateToPM");
m.vm.duplicateTo = "pm";
m.vm.duplicateDlg = true;
break; break;
case "report": case "report":
if (m.id != null) { if (m.id != null) {