This commit is contained in:
2022-03-05 01:12:40 +00:00
parent 19cf0086cd
commit f00cb7c413
6 changed files with 87 additions and 39 deletions

View File

@@ -837,3 +837,4 @@ Current v8 docs home: https://www.ayanova.com/docs/
BUILD 8.0.0-beta.1-rc4 CHANGES OF NOTE BUILD 8.0.0-beta.1-rc4 CHANGES OF NOTE
- subscriptions lists fixed bug where no type selected would display "[undefined]" in data list, now displays nothing

View File

@@ -7,7 +7,13 @@ export default {
"ERROR enums::get -> enumKey " + enumKey + " is missing from store" "ERROR enums::get -> enumKey " + enumKey + " is missing from store"
); );
} }
return window.$gz.store.state.enums[enumKey][enumValue];
const ret = window.$gz.store.state.enums[enumKey][enumValue];
if (ret == undefined) {
return "";
} else {
return ret;
}
} else { } else {
const ret = []; const ret = [];
if (enumValue == null || enumValue == 0) { if (enumValue == null || enumValue == 0) {

View File

@@ -485,6 +485,12 @@ export default {
params: { recordid: tid.id } params: { recordid: tid.id }
}); });
break; break;
case ayatype.CustomerNotifySubscription:
vm.$router.push({
name: "cust-notify-subscription",
params: { recordid: tid.id }
});
break;
default: default:
window.$gz.eventBus.$emit( window.$gz.eventBus.$emit(

View File

@@ -5,6 +5,17 @@
<v-form ref="form"> <v-form ref="form">
<v-row> <v-row>
<gz-error :error-box-message="formState.errorBoxMessage"></gz-error> <gz-error :error-box-message="formState.errorBoxMessage"></gz-error>
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-tag-picker
ref="customerTags"
v-model="obj.customerTags"
:label="$ay.t('CustomerTags')"
:readonly="formState.readOnly"
data-cy="customerTags"
:error-messages="form().serverErrors(this, 'customerTags')"
@input="fieldValueChanged('customerTags')"
></gz-tag-picker>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3"> <v-col cols="12" sm="6" lg="4" xl="3">
<v-select <v-select
ref="eventType" ref="eventType"
@@ -171,9 +182,24 @@
></gz-duration-picker> ></gz-duration-picker>
</v-col> </v-col>
<v-col v-if="showLinkReportId" cols="12" sm="6" lg="4" xl="3"> <v-col
ATTACH REPORT todo: dynamic list of reports to select from for v-if="showWorkOrderReportSelector"
type chosen cols="12"
sm="6"
lg="4"
xl="3"
>
<gz-pick-list
ref="linkReportId"
v-model="obj.linkReportId"
:aya-type="ayaTypes().Report"
:variant="ayaTypes().WorkOrder.toString()"
:readonly="formState.readOnly"
:label="$ay.t('AttachReport')"
data-cy="linkReportId"
:error-messages="form().serverErrors(this, 'linkReportId')"
@input="fieldValueChanged('linkReportId')"
></gz-pick-list>
</v-col> </v-col>
<v-col v-if="showTags" cols="12"> <v-col v-if="showTags" cols="12">
@@ -197,8 +223,8 @@
</div> </div>
</template> </template>
<script> <script>
const FORM_KEY = "notify-subscription"; const FORM_KEY = "customer-notify-subscription";
const API_BASE_URL = "notify-subscription/"; const API_BASE_URL = "customer-notify-subscription/";
export default { export default {
data() { data() {
return { return {
@@ -212,16 +238,14 @@ export default {
obj: { obj: {
id: 0, id: 0,
concurrency: 0, concurrency: 0,
userId: this.$store.state.userId,
ayaType: 0, ayaType: 0,
eventType: 0, eventType: 0,
advanceNotice: "00:00:00", advanceNotice: "00:00:00",
idValue: 0, idValue: 0,
decValue: 0, decValue: 0,
deliveryMethod: 1, linkReportId: null,
deliveryAddress: null, tags: [],
linkReportId: 0, customerTags: []
tags: []
}, },
formState: { formState: {
ready: false, ready: false,
@@ -307,15 +331,9 @@ export default {
return false; return false;
} }
}, },
showLinkReportId() { showWorkOrderReportSelector() {
//New NOTE NOTE: This is probably not required at the mo as customers are expected to login and view the reports as configured in global settings,
//so, if post release nothing relies on this it might be removed
//
//NOTE: Currently projected: Only Quotes and Workorders are involved in sending as attached reports
//And only to customers and only single items, not lists so it's doable to indicate a report id
//and send a link from notification to open the report
switch (this.obj.eventType) { switch (this.obj.eventType) {
case 999: //to be filled in later case 30: //workorder completed
return true; return true;
default: default:
return false; return false;
@@ -505,7 +523,7 @@ export default {
//POST //POST
vm.obj = res.data; vm.obj = res.data;
this.$router.replace({ this.$router.replace({
name: "customer-notify-subscription", name: "cust-notify-subscription",
params: { params: {
recordid: res.data.id, recordid: res.data.id,
obj: res.data obj: res.data
@@ -558,7 +576,7 @@ export default {
}, },
duplicate() { duplicate() {
this.$router.push({ this.$router.push({
name: "customer-notify-subscription", name: "cust-notify-subscription",
params: { params: {
recordid: 0, recordid: 0,
obj: this.obj obj: this.obj
@@ -586,7 +604,7 @@ async function clickHandler(menuItem) {
break; break;
case "new": case "new":
m.vm.$router.push({ m.vm.$router.push({
name: "customer-notify-subscription", name: "cust-notify-subscription",
params: { recordid: 0 } params: { recordid: 0 }
}); });
break; break;
@@ -611,7 +629,7 @@ function generateMenu(vm) {
readOnly: vm.formState.readOnly, readOnly: vm.formState.readOnly,
icon: "$ayiBullhorn", icon: "$ayiBullhorn",
title: "CustomerNotifySubscription", title: "CustomerNotifySubscription",
helpUrl: "home-notify-subscriptions", helpUrl: "customer-notify-subscriptions",
formData: { formData: {
ayaType: window.$gz.type.CustomerNotifySubscription, ayaType: window.$gz.type.CustomerNotifySubscription,
recordId: vm.$route.params.recordid recordId: vm.$route.params.recordid
@@ -685,7 +703,8 @@ async function fetchTranslatedText() {
"WorkOrderStatus", "WorkOrderStatus",
"Total", "Total",
"UiFieldDataTypesInteger", "UiFieldDataTypesInteger",
"QuoteQuoteStatusType" "QuoteQuoteStatusType",
"AttachReport"
]); ]);
} }
@@ -700,16 +719,16 @@ async function populateSelectionLists(vm) {
vm.selectLists.eventTypes = tempEventTypes.filter(z => { vm.selectLists.eventTypes = tempEventTypes.filter(z => {
//return true if it's a type allowed for customer //return true if it's a type allowed for customer
switch (z.id) { switch (z.id) {
case 6: case 6: //notifyCSRAccepted;
return window.$gz.store.state.customerRights.notifyCSRAccepted; return true;
case 7: case 7: //notifyCSRRejected;
return window.$gz.store.state.customerRights.notifyCSRRejected; return true;
case 21: case 21: //notifyServiceImminent;
return window.$gz.store.state.customerRights.notifyServiceImminent; return true;
case 30: //cust or inside user both case 30: //notifyWOCompleted;
return window.$gz.store.state.customerRights.notifyWOCompleted; return true;
case 31: case 31: //notifyWOCreated;
return window.$gz.store.state.customerRights.notifyWOCreated; return true;
default: default:
return false; return false;
} }

View File

@@ -17,7 +17,7 @@
</div> </div>
</template> </template>
<script> <script>
const FORM_KEY = "notify-subscriptions"; const FORM_KEY = "customer-notify-subscriptions";
export default { export default {
data() { data() {
return { return {
@@ -54,7 +54,7 @@ export default {
rowClick(item) { rowClick(item) {
//nav to item.id //nav to item.id
window.$gz.eventBus.$emit("openobject", { window.$gz.eventBus.$emit("openobject", {
type: window.$gz.type.NotifySubscription, type: window.$gz.type.CustomerNotifySubscription,
id: item.id id: item.id
}); });
}, },
@@ -108,10 +108,17 @@ export default {
if (info && info != "") { if (info && info != "") {
eventDisplay += ` - ${info}`; eventDisplay += ` - ${info}`;
} }
let typeDisplay = `[${window.$gz.enums.get(
"coreview",
o.ayaType
)}]`;
if (typeDisplay == "[]") {
typeDisplay = "";
}
ret.push({ ret.push({
id: o.id, id: o.id,
eventType: eventDisplay, eventType: eventDisplay,
ayaType: `[${window.$gz.enums.get("coreview", o.ayaType)}]`, ayaType: typeDisplay,
customerTags: window.$gz.util.formatTags(o.customerTags), customerTags: window.$gz.util.formatTags(o.customerTags),
tags: window.$gz.util.formatTags(o.tags) tags: window.$gz.util.formatTags(o.tags)
}); });
@@ -151,7 +158,7 @@ async function clickHandler(menuItem) {
switch (m.key) { switch (m.key) {
case "new": case "new":
m.vm.$router.push({ m.vm.$router.push({
name: "customer-notify-subscription", name: "cust-notify-subscription",
params: { recordid: 0 } params: { recordid: 0 }
}); });
break; break;

View File

@@ -106,10 +106,19 @@ export default {
if (info && info != "") { if (info && info != "") {
eventDisplay += ` - ${info}`; eventDisplay += ` - ${info}`;
} }
let typeDisplay = `[${window.$gz.enums.get(
"coreview",
o.ayaType
)}]`;
if (typeDisplay == "[]") {
typeDisplay = "";
}
ret.push({ ret.push({
id: o.id, id: o.id,
eventType: eventDisplay, eventType: eventDisplay,
ayaType: `[${window.$gz.enums.get("coreview", o.ayaType)}]`, ayaType: typeDisplay,
deliveryMethod: window.$gz.enums.get( deliveryMethod: window.$gz.enums.get(
"NotifyDeliveryMethod", "NotifyDeliveryMethod",
o.deliveryMethod o.deliveryMethod