This commit is contained in:
2021-02-18 19:41:54 +00:00
parent 9a54d39f7c
commit a26b3c9c68
2 changed files with 72 additions and 70 deletions

View File

@@ -112,7 +112,25 @@
@input="fieldValueChanged('referenceNumber')"
></v-text-field>
</v-col>
<v-col
v-if="form().showMe(this, 'ProjectId')"
cols="12"
sm="6"
lg="4"
xl="3"
>
<gz-pick-list
:aya-type="ayaTypes().Project"
:show-edit-icon="true"
v-model="obj.projectId"
:readonly="formState.readOnly"
:label="$ay.t('Project')"
ref="projectId"
data-cy="projectId"
:error-messages="form().serverErrors(this, 'projectId')"
@input="fieldValueChanged('projectId')"
></gz-pick-list>
</v-col>
<v-col
v-if="form().showMe(this, 'VendorMemo')"
cols="12"
@@ -190,74 +208,6 @@
></gz-pick-list>
</v-col>
<!--
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
v-model="obj.name"
:readonly="formState.readOnly"
:label="$ay.t('PurchaseOrderName')"
:rules="[form().required(this, 'name')]"
:error-messages="form().serverErrors(this, 'name')"
ref="name"
data-cy="name"
@input="fieldValueChanged('name')"
></v-text-field>
</v-col>
<v-col
v-if="form().showMe(this, 'PurchaseOrderDateStarted')"
cols="12"
sm="6"
lg="4"
xl="3"
>
<gz-date-time-picker
:label="$ay.t('PurchaseOrderDateStarted')"
v-model="obj.dateStarted"
:readonly="formState.readOnly"
ref="dateStarted"
test-id="dateStarted"
:error-messages="form().serverErrors(this, 'dateStarted')"
@input="fieldValueChanged('dateStarted')"
></gz-date-time-picker>
</v-col>
<v-col
v-if="form().showMe(this, 'PurchaseOrderDateCompleted')"
cols="12"
sm="6"
lg="4"
xl="3"
>
<gz-date-time-picker
:label="$ay.t('PurchaseOrderDateCompleted')"
:rules="[
form().datePrecedence(this, 'dateStarted', 'dateCompleted')
]"
:error-messages="form().serverErrors(this, 'dateCompleted')"
v-model="obj.dateCompleted"
:readonly="formState.readOnly"
ref="dateCompleted"
test-id="dateCompleted"
@input="fieldValueChanged('dateCompleted')"
></gz-date-time-picker>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-checkbox
v-model="obj.active"
:readonly="formState.readOnly"
:label="$ay.t('Active')"
ref="active"
data-cy="active"
:error-messages="form().serverErrors(this, 'active')"
@change="fieldValueChanged('active')"
></v-checkbox>
</v-col> -->
<!-- --------------------------------- -->
<v-col v-if="form().showMe(this, 'Notes')" cols="12">
<v-textarea
v-model="obj.notes"
@@ -270,6 +220,37 @@
auto-grow
></v-textarea>
</v-col>
{{ obj.items }}
<v-col cols="12">
<!-- <span class="title">{{ $ay.t("PurchaseOrderItemList") }}</span>
<v-btn @click="getBackupStatus" class="mb-6">
<v-icon>$ayiSync</v-icon>
</v-btn> -->
<v-data-table
:headers="headers"
:items="itemList"
class="elevation-1"
disable-pagination
disable-filtering
disable-sort
hide-default-footer
data-cy="itemsTable"
>
<template v-slot:top>
<span class="title">{{ $ay.t("PurchaseOrderItemList") }}</span>
</template>
<!-- <template v-slot:[`item.actions`]="{ item }">
<v-btn icon :href="item.url" v-if="item.url">
<v-icon small class="mr-2">
$ayiFileDownload
</v-icon>
</v-btn>
</template> -->
</v-data-table>
</v-col>
<!-- --------------------------------- -->
<v-col v-if="form().showMe(this, 'Tags')" cols="12">
<gz-tag-picker
@@ -399,6 +380,8 @@ export default {
selectLists: {
status: []
},
headers: [],
itemList: [],
obj:
//IMPORTANT NOTE: Fields that are NON NULLABLE in the schema for the table but *are* hideable **MUST** have a default value set here or else there will be no way to save the record
//I.E. Serial, usertype fields, ACTIVE
@@ -833,6 +816,23 @@ async function initForm(vm) {
await fetchTranslatedText(vm);
await window.$gz.formCustomTemplate.get(FORM_CUSTOM_TEMPLATE_KEY);
await populateSelectionLists(vm);
await createTableHeaders(vm);
}
//////////////////////
//
//
async function createTableHeaders(vm) {
vm.headers = [
{
text: vm.$ay.t("FileName"),
align: "start",
value: "name"
},
{ text: vm.$ay.t("FileDate"), value: "created" },
{ text: vm.$ay.t("FileSize"), value: "length" },
{ text: "", value: "actions", sortable: false }
];
}
//////////////////////
@@ -865,6 +865,7 @@ async function fetchTranslatedText(vm) {
"Project",
"PurchaseOrderReceiptText1",
"PurchaseOrderReceiptText2",
"PurchaseOrderItemList",
"PurchaseOrderCustom1",
"PurchaseOrderCustom2",
"PurchaseOrderCustom3",