This commit is contained in:
2021-04-06 23:46:14 +00:00
parent 57c4034163
commit cb93e3ef28
3 changed files with 129 additions and 22 deletions

View File

@@ -24,10 +24,10 @@
</v-list>
</v-menu>
</v-col>
<!--
<span class="text-caption"
>[selected su_index: {{ pvm.selectedScheduledUserItemIndex }}]</span
>
> -->
<template v-if="pvm.scheduledUserItemCount > 1">
<!-- ################################ SCHEDULED USERS TABLE ############################### -->
<v-col cols="12">
@@ -39,7 +39,7 @@
disable-filtering
disable-sort
hide-default-footer
data-cy="itemsTable"
data-cy="scheduledUsersTable"
dense
:item-class="itemRowClasses"
@click:row="selectItem"
@@ -94,6 +94,9 @@ export default {
newItem() {
console.log("STUB: NEW ITEM");
},
selectItem: function(item) {
this.pvm.selectedScheduledUserItemIndex = item.index;
},
form() {
return window.$gz.form;
},
@@ -101,9 +104,110 @@ export default {
if (!this.formState.loading && !this.formState.readonly) {
window.$gz.form.fieldValueChanged(this.pvm, ref);
}
},
itemRowClasses: function(item) {
if (this.form().childRowHasError(this, "ScheduledUsers", item.index)) {
return "font-weight-black font-italic error--text";
}
}
},
computed: {
headerList: function() {
/*
public long? UserId { get; set; }
public decimal EstimatedQuantity { get; set; }
public DateTime? StartDate { get; set; }
public DateTime? StopDate { get; set; }
public long? ServiceRateId { get; set; }
IN ORDER: start, stop, quantity, user, rate
If the column is a text, left-align it
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
if (
this.form().showMe(
this,
"ScheduledUsers.WorkOrderItemScheduledUserStartDate"
)
) {
headers.push({
text: this.$ay.t("WorkOrderItemScheduledUserStartDate"),
align: "right",
value: "startDate"
});
}
if (
this.form().showMe(
this,
"ScheduledUsers.WorkOrderItemScheduledUserStopDate"
)
) {
headers.push({
text: this.$ay.t("WorkOrderItemScheduledUserStopDate"),
align: "right",
value: "stopDate"
});
}
if (
this.form().showMe(
this,
"ScheduledUsers.WorkOrderItemScheduledUserEstimatedQuantity"
)
) {
headers.push({
text: this.$ay.t("WorkOrderItemScheduledUserEstimatedQuantity"),
align: "right",
value: "quantity"
});
}
headers.push({
text: this.$ay.t("WorkOrderItemScheduledUserUserID"),
align: "left",
value: "userViz"
});
headers.push({
text: this.$ay.t("WorkOrderItemScheduledUserServiceRateID"),
align: "left",
value: "rateViz"
});
// headers.push({ text: "", value: "actions" });
return headers;
},
itemList: function() {
return this.value.items.map((x, i) => {
return {
index: i,
id: x.id,
startDate: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
x.startDate,
this.pvm.timeZoneName,
this.pvm.languageName,
this.pvm.hour12
),
stopDate: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
x.stopDate,
this.pvm.timeZoneName,
this.pvm.languageName,
this.pvm.hour12
),
userViz: x.userViz,
rateViz: x.rateViz
};
});
},
formState: function() {
return this.pvm.formState;
},

View File

@@ -154,48 +154,48 @@ and it's probably not a big list to fill anyway
If the column is a number or number + unit, (or date) right-align it (like excel)
*/
let headers = [];
let vm = this;
headers.push({
text: vm.$ay.t("WorkOrderItemSummary"), //mandatory not hidden
text: this.$ay.t("WorkOrderItemSummary"), //mandatory not hidden
align: "left",
value: "notes"
});
if (vm.form().showMe(vm, "Items.WorkOrderItemWorkOrderStatusID")) {
if (this.form().showMe(this, "Items.WorkOrderItemWorkOrderStatusID")) {
headers.push({
text: vm.$ay.t("WorkOrderItemWorkOrderStatusID"),
text: this.$ay.t("WorkOrderItemWorkOrderStatusID"),
align: "left",
value: "status"
});
}
if (vm.form().showMe(vm, "Items.RequestDate")) {
if (this.form().showMe(this, "Items.RequestDate")) {
headers.push({
text: vm.$ay.t("WorkOrderItemRequestDate"),
text: this.$ay.t("WorkOrderItemRequestDate"),
align: "right",
value: "requestDate"
});
}
if (vm.form().showMe(vm, "Items.WorkOrderItemPriorityID")) {
if (this.form().showMe(this, "Items.WorkOrderItemPriorityID")) {
headers.push({
text: vm.$ay.t("WorkOrderItemPriorityID"),
text: this.$ay.t("WorkOrderItemPriorityID"),
align: "left",
value: "priority"
});
}
if (vm.form().showMe(vm, "Items.WorkOrderItemWarrantyService")) {
if (this.form().showMe(this, "Items.WorkOrderItemWarrantyService")) {
headers.push({
text: vm.$ay.t("WorkOrderItemWarrantyService"),
text: this.$ay.t("WorkOrderItemWarrantyService"),
align: "center",
value: "warranty"
});
}
if (vm.form().showMe(vm, "Items.Tags")) {
if (this.form().showMe(this, "Items.Tags")) {
headers.push({
text: vm.$ay.t("Tags"),
text: this.$ay.t("Tags"),
align: "left",
value: "tags"
});
@@ -206,22 +206,21 @@ and it's probably not a big list to fill anyway
return headers;
},
itemList: function() {
let vm = this;
return vm.value.items.map((x, i) => {
return this.value.items.map((x, i) => {
return {
index: i,
id: x.id,
notes: x.notes,
quantityReceived: window.$gz.locale.decimalLocalized(
x.quantityReceived,
vm.languageName
this.pvm.languageName
),
status: x.workorderItemStatusId, //todo: get real status name etc here
requestDate: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
x.requestDate,
vm.timeZoneName,
vm.languageName,
vm.hour12
this.pvm.timeZoneName,
this.pvm.languageName,
this.pvm.hour12
),
priority: x.workorderItemPriorityId, //todo: get actual priority, color etc here
warranty: x.warrantyService,

View File

@@ -88,7 +88,7 @@ export default {
valid: true
});
//If there is a single woitem then select it otherwise keep it clean and empty by not selecting thus not showing
//If there is a single woitem then select it otherwise keep it clean and empty by not selecting thus not showing
//edit form as per design
if (vm.obj.items.length > 0) {
if (vm.obj.items.length == 1) {
@@ -190,6 +190,10 @@ export default {
},
rights: window.$gz.role.defaultRightsObject(), //overall workorder rights, supersedes subrights
ayaType: window.$gz.type.WorkOrder,
currencyName: window.$gz.locale.getCurrencyName(),
timeZoneName: window.$gz.locale.getResolvedTimeZoneName(),
languageName: window.$gz.locale.getResolvedLanguage(),
hour12: window.$gz.locale.getHour12(),
selectedItemIndex: null,
selectedScheduledUserItemIndex: null,
selectLists: {