This commit is contained in:
2021-08-05 19:30:04 +00:00
parent 893768912b
commit b693dd926a
2 changed files with 53 additions and 46 deletions

View File

@@ -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

View File

@@ -32,13 +32,13 @@
<v-progress-circular indeterminate :size="64" />
</v-overlay>
<!-- ################################################################################-->
<!-- ########################## GENERATE WO DIALOG ###############################-->
<!-- ########################## DUPLICATE DIALOG ###############################-->
<!-- ################################################################################-->
<template>
<v-row justify="center">
<v-dialog persistent max-width="600px" v-model="genWODlg">
<v-dialog persistent max-width="600px" v-model="duplicateDlg">
<v-card>
<v-card-title>{{ $ay.t("DuplicateToWorkOrder") }}</v-card-title>
<v-card-title>{{ duplicateDlgTitle }}</v-card-title>
<v-card-text>
<v-checkbox
v-model="genCopyWiki"
@@ -51,45 +51,12 @@
></v-checkbox>
</v-card-text>
<v-card-actions>
<v-btn text @click="genWODlg = 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="generateWorkOrder()">{{
$ay.t("OK")
}}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-row>
</template>
<!-- ################################################################################-->
<!-- ########################## GENERATE QUOTE DIALOG ###############################-->
<!-- ################################################################################-->
<template>
<v-row justify="center">
<v-dialog persistent max-width="600px" v-model="genQuoteDlg">
<v-card>
<v-card-title>{{ $ay.t("DuplicateToQuote") }}</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="genQuoteDlg = false" color="primary">{{
$ay.t("Cancel")
}}</v-btn>
<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>
@@ -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) {