This commit is contained in:
2021-03-07 21:06:25 +00:00
parent 290c5963c5
commit 71af22af84
3 changed files with 153 additions and 30 deletions

View File

@@ -181,6 +181,9 @@ export default {
//this is required for the control to update and parent form to detect it
this.$emit("input", e.id);
//this is sometimes required for forms that need the full selection value
this.$emit("update:name", e.name);
this.$emit("update:active", e.active);
},
fetchValueIfNotPresent() {
//is there a value that might require fetching?

View File

@@ -362,24 +362,18 @@
v-for="(item, index) in obj.serviceRateItems"
:key="item.Id"
>
<td class="text-right">
<gz-pick-list
:allow-no-selection="false"
:can-clear="false"
:aya-type="ayaTypes().ServiceRate"
:show-edit-icon="false"
v-model="item.serviceRateId"
></gz-pick-list>
<td class="text-left">
{{ item.serviceRateViz }}
</td>
<td class="text-right">
<v-btn
@click="removeServiceRateItem(index)"
icon
@click="editServiceRateItem(index)"
class="ml-4"
>
<v-icon>
$ayiTrashAlt
$ayiEdit
</v-icon>
</v-btn>
</td>
@@ -605,7 +599,7 @@
<v-btn
color="blue darken-1"
text
@click="editPoItemDialog = false"
@click="editContractPartOverrideItemDialog = false"
>{{ $ay.t("Close") }}</v-btn
>
@@ -794,7 +788,7 @@
<v-btn
color="blue darken-1"
text
@click="editPoItemDialog = false"
@click="editContractServiceRateOverrideItemDialog = false"
>{{ $ay.t("Close") }}</v-btn
>
@@ -983,7 +977,7 @@
<v-btn
color="blue darken-1"
text
@click="editPoItemDialog = false"
@click="editContractTravelRateOverrideItemDialog = false"
>{{ $ay.t("Close") }}</v-btn
>
@@ -1044,6 +1038,122 @@
</v-dialog>
</v-row>
</template>
<!-- #########################################################################################################-->
<!-- ########################## SERVICE RATE ITEM EDIT FORM ###############################-->
<!-- #########################################################################################################-->
<template v-if="obj.serviceRateItems.length">
<v-row justify="center">
<v-dialog v-model="editServiceRateItemDialog">
<v-card>
<v-card-title> </v-card-title>
<v-card-text>
<v-row>
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-pick-list
:allow-no-selection="false"
:can-clear="false"
:aya-type="ayaTypes().ServiceRate"
:show-edit-icon="true"
v-model="
obj.serviceRateItems[editServiceRateItemIndex]
.serviceRateId
"
:readonly="formState.readOnly"
:label="$ay.t('ServiceRate')"
ref="userid"
data-cy="userid"
:rules="[
form().integerValid(
this,
'ServiceRateItems.ServiceRateId'
),
form().required(this, 'ServiceRateItems.ServiceRateId')
]"
:error-messages="
form().serverErrors(
this,
`ServiceRateItems[${editServiceRateItemIndex}].ServiceRateId`
)
"
@input="
fieldValueChanged(
`ServiceRateItems[${editServiceRateItemIndex}].ServiceRateId`
)
"
:name.sync="
obj.serviceRateItems[editServiceRateItemIndex]
.serviceRateViz
"
></gz-pick-list>
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
<template v-if="!$vuetify.breakpoint.xs">
<v-btn
color="red darken-1"
text
@click="deleteServiceRateItem(editServiceRateItemIndex)"
>{{ $ay.t("Delete") }}</v-btn
>
<v-spacer></v-spacer>
<v-btn
color="blue darken-1"
text
@click="addServiceRateItem()"
class="ml-4"
>{{ $ay.t("New") }}</v-btn
>
<v-btn
color="blue darken-1"
text
@click="editServiceRateItemDialog = false"
class="ml-4"
>{{ $ay.t("OK") }}</v-btn
>
</template>
<template v-else>
<!-- MOBILE FORMAT -->
<v-row>
<v-btn
class="mt-4"
block
text
color="blue darken-1"
@click="editServiceRateItemDialog = false"
>{{ $ay.t("OK") }}</v-btn
>
<v-btn
class="mt-4"
block
text
color="blue darken-1"
@click="addServiceRateItem()"
>{{ $ay.t("New") }}</v-btn
>
<v-btn
class="mt-8 mb-6"
block
text
color="red darken-1"
@click="
deleteContractServiceRateOverrideItem(
obj.serviceRateItems[editServiceRateItemIndex]
)
"
>{{ $ay.t("Delete") }}</v-btn
>
</v-row>
</template>
</v-card-actions>
</v-card>
</v-dialog>
</v-row>
</template>
</div>
</template>
@@ -1166,7 +1276,11 @@ export default {
editContractServiceRateOverrideItemDialog: false,
editContractServiceRateOverrideItemIndex: 0,
editContractTravelRateOverrideItemDialog: false,
editContractTravelRateOverrideItemIndex: 0
editContractTravelRateOverrideItemIndex: 0,
editServiceRateItemDialog: false,
editServiceRateItemIndex: 0,
editTravelRateItemDialog: false,
editTravelRateItemIndex: 0
};
},
//WATCHERS
@@ -1299,22 +1413,25 @@ export default {
this.editContractTravelRateOverrideItemIndex = 0;
this.formState.dirty = true;
},
addServiceRateItem: function() {
this.obj.serviceRateItems.push({
id: 0,
contractId: this.obj.id,
serviceRateId: null
});
this.editServiceRateItemIndex =
this.obj.serviceRateItems.push({
id: 0,
contractId: this.obj.id,
serviceRateId: null
}) - 1;
this.editServiceRateItemDialog = true;
this.formState.dirty = true;
},
removeServiceRateItem: function(index) {
editServiceRateItem: function(index) {
this.editServiceRateItemIndex = index;
this.editServiceRateItemDialog = true;
},
deleteServiceRateItem: function(index) {
this.obj.serviceRateItems.splice(index, 1);
this.formState.dirty = true;
},
canSave: function() {
return this.formState.valid && this.formState.dirty;
},