This commit is contained in:
2021-07-26 22:35:59 +00:00
parent 41303e7726
commit 123582f93c
3 changed files with 300 additions and 60 deletions

View File

@@ -11,7 +11,7 @@
<v-text-field
v-model="value.serial"
:readonly="formState.readOnly"
:label="$ay.t('WorkOrderSerialNumber')"
:label="$ay.t('QuoteSerialNumber')"
ref="serial"
data-cy="serial"
:rules="[
@@ -40,7 +40,33 @@
<v-col
v-if="
form().showMe(this, 'WorkOrderStatus') &&
form().showMe(this, 'QuotePreparedByID') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
xl="3"
>
<gz-pick-list
:aya-type="$ay.ayt().User"
:show-edit-icon="!value.userIsRestrictedType"
v-model="value.preparedById"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('QuotePreparedByID')"
ref="preparedById"
data-cy="preparedById"
:error-messages="form().serverErrors(this, 'preparedById')"
@input="fieldValueChanged('preparedById')"
></gz-pick-list>
</v-col>
<v-col
v-if="
form().showMe(this, 'QuoteStatus') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
@@ -79,7 +105,27 @@
data-cy="woAddress"
/>
</v-col>
<v-col
v-if="
form().showMe(this, 'QuoteIntroduction') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
>
<v-textarea
v-model="value.introduction"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('QuoteIntroduction')"
:error-messages="form().serverErrors(this, 'introduction')"
ref="introduction"
data-cy="introduction"
@input="fieldValueChanged('introduction')"
auto-grow
></v-textarea>
</v-col>
<v-col
v-if="
form().showMe(this, 'WorkOrderSummary') &&
@@ -104,7 +150,7 @@
<v-col
v-if="
form().showMe(this, 'WorkOrderCloseByDate') &&
form().showMe(this, 'QuoteQuoteRequestDate') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
@@ -116,13 +162,85 @@
xl="3"
>
<gz-date-time-picker
:label="$ay.t('WorkOrderCloseByDate')"
v-model="value.completeByDate"
:label="$ay.t('QuoteQuoteRequestDate')"
v-model="value.requested"
:readonly="formState.readOnly || value.userIsTechRestricted"
ref="completeByDate"
data-cy="completeByDate"
:error-messages="form().serverErrors(this, 'completeByDate')"
@input="fieldValueChanged('completeByDate')"
ref="requested"
data-cy="requested"
:error-messages="form().serverErrors(this, 'requested')"
@input="fieldValueChanged('requested')"
></gz-date-time-picker>
</v-col>
<v-col
v-if="
form().showMe(this, 'QuoteValidUntilDate') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
xl="3"
>
<gz-date-time-picker
:label="$ay.t('QuoteValidUntilDate')"
v-model="value.validUntil"
:readonly="formState.readOnly || value.userIsTechRestricted"
ref="validUntil"
data-cy="validUntil"
:error-messages="form().serverErrors(this, 'validUntil')"
@input="fieldValueChanged('validUntil')"
></gz-date-time-picker>
</v-col>
<v-col
v-if="
form().showMe(this, 'QuoteDateSubmitted') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
xl="3"
>
<gz-date-time-picker
:label="$ay.t('QuoteDateSubmitted')"
v-model="value.submitted"
:readonly="formState.readOnly || value.userIsTechRestricted"
ref="submitted"
data-cy="submitted"
:error-messages="form().serverErrors(this, 'submitted')"
@input="fieldValueChanged('submitted')"
></gz-date-time-picker>
</v-col>
<v-col
v-if="
form().showMe(this, 'QuoteDateApproved') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
xl="3"
>
<gz-date-time-picker
:label="$ay.t('QuoteDateApproved')"
v-model="value.approved"
:readonly="formState.readOnly || value.userIsTechRestricted"
ref="approved"
data-cy="approved"
:error-messages="form().serverErrors(this, 'approved')"
@input="fieldValueChanged('approved')"
></gz-date-time-picker>
</v-col>
@@ -178,54 +296,6 @@
></gz-pick-list>
</v-col>
<v-col
v-if="
form().showMe(this, 'WorkOrderInvoiceNumber') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
xl="3"
>
<v-text-field
v-model="value.invoiceNumber"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('WorkOrderInvoiceNumber')"
ref="invoiceNumber"
data-cy="invoiceNumber"
:error-messages="form().serverErrors(this, 'invoiceNumber')"
@input="fieldValueChanged('invoiceNumber')"
></v-text-field>
</v-col>
<v-col
v-if="
form().showMe(this, 'WorkOrderServiceDate') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
xl="3"
>
<gz-date-time-picker
:label="$ay.t('WorkOrderServiceDate')"
v-model="value.serviceDate"
:readonly="formState.readOnly || value.userIsTechRestricted"
ref="serviceDate"
data-cy="serviceDate"
:error-messages="form().serverErrors(this, 'serviceDate')"
@input="fieldValueChanged('serviceDate')"
></gz-date-time-picker>
</v-col>
<v-col
v-if="form().showMe(this, 'WorkOrderCustomerContactName')"
cols="12"
@@ -321,6 +391,56 @@
></v-checkbox>
</v-col>
<v-col
v-if="
form().showMe(this, 'CopyWiki') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
xl="3"
>
<v-checkbox
v-model="value.copyWiki"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('CopyWiki')"
ref="copyWiki"
data-cy="copyWiki"
:error-messages="form().serverErrors(this, 'copyWiki')"
@change="fieldValueChanged('copyWiki')"
></v-checkbox>
</v-col>
<v-col
v-if="
form().showMe(this, 'CopyAttachments') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
xl="3"
>
<v-checkbox
v-model="value.copyAttachments"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('CopyAttachments')"
ref="copyAttachments"
data-cy="copyAttachments"
:error-messages="form().serverErrors(this, 'copyAttachments')"
@change="fieldValueChanged('copyAttachments')"
></v-checkbox>
</v-col>
<v-col
v-if="
form().showMe(this, 'Tags') &&
@@ -455,6 +575,15 @@ export default {
};
/*
l.Add(new FormField { TKey = "QuotePreparedByID", FieldKey = "QuotePreparedByID" });
l.Add(new FormField { TKey = "QuoteIntroduction", FieldKey = "QuoteIntroduction" });
l.Add(new FormField { TKey = "QuoteQuoteRequestDate", FieldKey = "QuoteQuoteRequestDate" });
l.Add(new FormField { TKey = "QuoteValidUntilDate", FieldKey = "QuoteValidUntilDate" });
l.Add(new FormField { TKey = "QuoteDateSubmitted", FieldKey = "QuoteDateSubmitted" });
l.Add(new FormField { TKey = "QuoteDateApproved", FieldKey = "QuoteDateApproved" });
l.Add(new FormField { TKey = "CopyWiki", FieldKey = "CopyWiki" });
l.Add(new FormField { TKey = "CopyAttachments", FieldKey = "CopyAttachments" });
Example workorder
{
id: 10,

View File

@@ -0,0 +1,111 @@
<template>
<div>
<gz-report-selector ref="reportSelector"></gz-report-selector>
<gz-extensions
:aya-type="$ay.ayt().QuoteStatus"
:selected-items="selectedItems"
ref="extensions"
>
</gz-extensions>
<gz-data-table
ref="gzdatatable"
form-key="svc-quote-status"
data-list-key="QuoteStatusDataList"
:show-select="rights.read"
:reload="reload"
@selection-change="handleSelected"
data-cy="woStatusTable"
>
</gz-data-table>
</div>
</template>
<script>
const FORM_KEY = "svc-quote-status";
export default {
created() {
this.rights = window.$gz.role.getRights(window.$gz.type.QuoteStatus);
window.$gz.eventBus.$on("menu-click", clickHandler);
generateMenu(this);
},
beforeDestroy() {
window.$gz.eventBus.$off("menu-click", clickHandler);
},
data() {
return {
rights: window.$gz.role.defaultRightsObject(),
selectedItems: [],
reload: false
};
},
methods: {
handleSelected(selected) {
this.selectedItems = selected;
}
}
};
/////////////////////////////
//
//
async function clickHandler(menuItem) {
if (!menuItem) {
return;
}
let m = window.$gz.menu.parseMenuItem(menuItem);
if (m.owner == FORM_KEY && !m.disabled) {
switch (m.key) {
case "new":
m.vm.$router.push({
name: "svc-quote-status-edit",
params: { recordid: 0 }
});
break;
case "extensions":
let res = await m.vm.$refs.extensions.open(
m.vm.$refs.gzdatatable.getDataListSelection(
window.$gz.type.QuoteStatus
)
);
if (res && res.refresh == true) {
m.vm.reload = !m.vm.reload;
}
break;
default:
window.$gz.eventBus.$emit(
"notify-warning",
FORM_KEY + "::context click: [" + m.key + "]"
);
}
}
}
//////////////////////
//
//
function generateMenu(vm) {
let menuOptions = {
isMain: true,
icon: "$ayiFlag",
title: "QuoteStatusList",
helpUrl: "svc-quote-status",
menuItems: [],
formData: {
ayaType: window.$gz.type.QuoteStatus
}
};
if (vm.rights.change) {
menuOptions.menuItems.push({
title: "New",
icon: "$ayiPlus",
surface: true,
key: FORM_KEY + ":new",
vm: vm
});
}
window.$gz.eventBus.$emit("menu-change", menuOptions);
}
</script>

View File

@@ -57,7 +57,7 @@
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-role-picker
:label="$ay.t('WorkOrderStatusRemoveRoles')"
:label="$ay.t('RemoveRoles')"
v-model="obj.removeRoles"
:readonly="formState.readOnly"
ref="removeRoles"
@@ -525,7 +525,7 @@ async function fetchTranslatedText() {
"WorkOrderStatusCompleted",
"WorkOrderStatusLocked",
"SelectRoles",
"WorkOrderStatusRemoveRoles",
"RemoveRoles",
"WorkOrderStatusColor",
"WorkOrderStatusNotes"
]);