This commit is contained in:
2021-07-28 23:16:42 +00:00
parent 1ee05ce284
commit a6dc3bc35b
4 changed files with 199 additions and 55 deletions

View File

@@ -40,7 +40,7 @@
<!-- ################################################################################-->
<template>
<v-row justify="center">
<v-dialog persistent max-width="600px" v-model="genDlg">
<v-dialog persistent max-width="600px" v-model="genWODlg">
<v-card>
<v-card-title>{{ $ay.t("DuplicateToWorkOrder") }}</v-card-title>
<v-card-text>
@@ -55,7 +55,7 @@
></v-checkbox>
</v-card-text>
<v-card-actions>
<v-btn text @click="genDlg = false" color="primary">{{
<v-btn text @click="genWODlg = false" color="primary">{{
$ay.t("Cancel")
}}</v-btn>
<v-spacer></v-spacer>
@@ -68,6 +68,39 @@
</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()">{{
$ay.t("OK")
}}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-row>
</template>
</div>
</template>
@@ -270,7 +303,8 @@ 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
genDlg: false,
genWODlg: false,
genQuoteDlg: false,
genCopyWiki: false,
genCopyAttachments: false
};
@@ -626,7 +660,41 @@ 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;
//set quote specific fields
cp.preparedById = window.$gz.store.state.userId;
cp.introduction = null;
cp.requested = window.$gz.locale.nowUTC8601String();
cp.validUntil = null;
cp.submitted = null;
cp.approved = null;
//Navigate to new record
this.$router.push({
name: "quote-edit",
params: {
recordid: 0,
obj: cp
}
});
},
/////////////////////////////////////////////////////////
// Clean woitem and children so it's
// savable as a new record
@@ -1624,7 +1692,10 @@ async function clickHandler(menuItem) {
});
break;
case "genwo":
m.vm.genDlg = true;
m.vm.genWODlg = true;
break;
case "genquote":
m.vm.genQuoteDlg = true;
break;
case "duplicate":
m.vm.duplicate();
@@ -1775,6 +1846,19 @@ function generateMenu(vm) {
});
}
if (
vm.rights.change &&
vm.$route.params.recordid != 0 &&
!vm.obj.userIsRestrictedType
) {
menuOptions.menuItems.push({
title: "Duplicate",
icon: "$ayiClone",
key: FORM_KEY + ":duplicate",
vm: vm
});
}
if (
vm.rights.change &&
vm.$route.params.recordid != 0 &&
@@ -1794,9 +1878,9 @@ function generateMenu(vm) {
!vm.obj.userIsRestrictedType
) {
menuOptions.menuItems.push({
title: "Duplicate",
icon: "$ayiClone",
key: FORM_KEY + ":duplicate",
title: "DuplicateToQuote",
icon: "$ayiPencilAlt",
key: FORM_KEY + ":genquote",
vm: vm
});
}
@@ -1855,6 +1939,7 @@ async function fetchTranslatedText(vm) {
"PMSerialNumber",
"WorkOrderSummary",
"DuplicateToWorkOrder",
"DuplicateToQuote",
"Contract",
"Project",
"WorkOrderCustomerContactName",

View File

@@ -40,7 +40,7 @@
<!-- ################################################################################-->
<template>
<v-row justify="center">
<v-dialog persistent max-width="600px" v-model="genDlg">
<v-dialog persistent max-width="600px" v-model="genWODlg">
<v-card>
<v-card-title>{{ $ay.t("DuplicateToWorkOrder") }}</v-card-title>
<v-card-text>
@@ -55,7 +55,7 @@
></v-checkbox>
</v-card-text>
<v-card-actions>
<v-btn text @click="genDlg = false" color="primary">{{
<v-btn text @click="genWODlg = false" color="primary">{{
$ay.t("Cancel")
}}</v-btn>
<v-spacer></v-spacer>
@@ -68,6 +68,39 @@
</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")
}}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-row>
</template>
</div>
</template>
@@ -268,7 +301,8 @@ 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
genDlg: false,
genWODlg: false,
genPMDlg: false,
genCopyWiki: false,
genCopyAttachments: false
};
@@ -665,7 +699,33 @@ export default {
}
});
},
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
@@ -1697,7 +1757,10 @@ async function clickHandler(menuItem) {
});
break;
case "genwo":
m.vm.genDlg = true;
m.vm.genWODlg = true;
break;
case "genpm":
m.vm.genPMDlg = true;
break;
case "duplicate":
m.vm.duplicate();
@@ -1848,6 +1911,19 @@ function generateMenu(vm) {
});
}
if (
vm.rights.change &&
vm.$route.params.recordid != 0 &&
!vm.obj.userIsRestrictedType
) {
menuOptions.menuItems.push({
title: "Duplicate",
icon: "$ayiClone",
key: FORM_KEY + ":duplicate",
vm: vm
});
}
if (
vm.rights.change &&
vm.$route.params.recordid != 0 &&
@@ -1867,9 +1943,9 @@ function generateMenu(vm) {
!vm.obj.userIsRestrictedType
) {
menuOptions.menuItems.push({
title: "Duplicate",
icon: "$ayiClone",
key: FORM_KEY + ":duplicate",
title: "DuplicateToPM",
icon: "$ayiBusinessTime",
key: FORM_KEY + ":genpm",
vm: vm
});
}
@@ -1934,6 +2010,7 @@ async function fetchTranslatedText(vm) {
"QuoteSerialNumber",
"WorkOrderSummary",
"DuplicateToWorkOrder",
"DuplicateToPM",
"Contract",
"Project",
"WorkOrderCustomerContactName",

View File

@@ -102,7 +102,6 @@
</v-row>
</template>
</div>
<!-- :reset-selections="resetSelections" -->
</template>
<script>
@@ -701,6 +700,14 @@ export default {
});
cp.id = 0;
//set quote specific fields
cp.preparedById = window.$gz.store.state.userId;
cp.introduction = null;
cp.requested = window.$gz.locale.nowUTC8601String();
cp.validUntil = null;
cp.submitted = null;
cp.approved = null;
//Navigate to new record
this.$router.push({
name: "quote-edit",
@@ -1998,6 +2005,19 @@ function generateMenu(vm) {
});
}
if (
vm.rights.change &&
vm.$route.params.recordid != 0 &&
!vm.obj.userIsRestrictedType
) {
menuOptions.menuItems.push({
title: "Duplicate",
icon: "$ayiClone",
key: FORM_KEY + ":duplicate",
vm: vm
});
}
if (
vm.rights.change &&
vm.$route.params.recordid != 0 &&
@@ -2024,19 +2044,6 @@ function generateMenu(vm) {
});
}
if (
vm.rights.change &&
vm.$route.params.recordid != 0 &&
!vm.obj.userIsRestrictedType
) {
menuOptions.menuItems.push({
title: "Duplicate",
icon: "$ayiClone",
key: FORM_KEY + ":duplicate",
vm: vm
});
}
//--- /show all ---
if (!vm.obj.userIsRestrictedType) {