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.states = [];
cp.lastStatusId = undefined;
cp.items.forEach(x => {
x.partRequests = [];
});

View File

@@ -31,15 +31,14 @@
<v-overlay :value="!formState.ready || formState.loading">
<v-progress-circular indeterminate :size="64" />
</v-overlay>
<!-- </template> -->
<!-- ################################################################################-->
<!-- ########################## GENERATE QUOTE DIALOG ###############################-->
<!-- ########################## DUPLICATE DIALOG ###############################-->
<!-- ################################################################################-->
<template>
<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-title>{{ $ay.t("DuplicateToQuote") }}</v-card-title>
<v-card-title>{{ duplicateDlgTitle }}</v-card-title>
<v-card-text>
<v-checkbox
v-model="genCopyWiki"
@@ -52,45 +51,12 @@
></v-checkbox>
</v-card-text>
<v-card-actions>
<v-btn text @click="genQuoteDlg = false" color="primary">{{
<v-btn text @click="duplicateDlg = false" color="primary">{{
$ay.t("Cancel")
}}</v-btn>
<v-spacer></v-spacer>
<v-btn color="primary" text @click="generateQuote()">{{
$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()">{{
<v-btn color="primary" text @click="duplicateHandler()">{{
$ay.t("OK")
}}</v-btn>
</v-card-actions>
@@ -306,8 +272,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
genPMDlg: false,
genQuoteDlg: false,
duplicateDlg: false,
duplicateDlgTitle: null,
duplicateTo: null, //"pm","wo" or "quote"
genCopyWiki: false,
genCopyAttachments: false
};
@@ -669,13 +636,47 @@ export default {
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() {
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
this.$router.push({
name: "workorder-edit",
params: {
recordid: 0,
obj: this.obj
obj: cp
}
});
},
@@ -692,6 +693,7 @@ export default {
cp.wiki = null; //already copied, need to remove it instead
}
cp.states = [];
cp.lastStatusId = undefined;
cp.items.forEach(x => {
x.partRequests = [];
});
@@ -1858,14 +1860,20 @@ async function clickHandler(menuItem) {
params: { recordid: 0 }
});
break;
case "genpm":
m.vm.genPMDlg = true;
case "duplicate":
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();
case "genpm":
m.vm.duplicateDlgTitle = m.vm.$ay.t("DuplicateToPM");
m.vm.duplicateTo = "pm";
m.vm.duplicateDlg = true;
break;
case "report":
if (m.id != null) {