This commit is contained in:
2021-03-07 23:52:15 +00:00
parent f86f6a1f64
commit 51b2120548
2 changed files with 224 additions and 45 deletions

View File

@@ -35,6 +35,7 @@ MISC ITEMS THAT CAME UP
todo: BUGBUG delete all tags from customer, go back in and zone2 appears for some reason
todo: maybe Active field should be beside name as before in v7, it can get kind of buried and it also seems like it would be clearer if it was beside the name what it referred to
todo: attach a photo from phone, no error just does nothing
Test locally first to confirm, probably a rights issue of some kind
@@ -192,12 +193,14 @@ todo: Changes to allow in place updates of server:
CURRENTLY DOING: Contract form - rates list and restrict to rates checkbox etc
need restrict to rates checkbox, then help docs and then done
todo: limit to contractrate checkbox missing in rates
todo: service rates contract list
biz rule No dupes rule at server
limit to contract rates only in picklist???
biz rule contract rates only must have some contract rates selected
'' travel
todo: form save full update like po
todo: make other list / edit forms same as service rates list / edit form
use list index, NOT id for crud ops
way it deletes
@@ -205,14 +208,13 @@ todo: make other list / edit forms same as service rates list / edit form
todo: Maybe don't need alt format buttons for narrow view??
todo: foreign key check in rate validatedelete now that service rate can be set on contract
todo: edit item by item being passed in is flawed potentially because it looks for ID to match when in reality it should pass the index
because id is 0 for added items and there could be two added items
every op should be by index to ensure it works properly
go back and fix the ones by looking at teh edit first to find the by id and then switchup to index like for contract service rates which does it correctly
todo: limit to contractrate checkbox missing in rates
todo: might want to put more fields in the contractdatalist, it's very sparse adn the old v7 had pretty much all the fields as well

View File

@@ -17,7 +17,17 @@
@input="fieldValueChanged('name')"
></v-text-field>
</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 cols="12" sm="6" lg="4" xl="3">
<gz-duration-picker
v-model="obj.responseTime"
@@ -31,7 +41,7 @@
></gz-duration-picker>
</v-col>
<v-col cols="12">
<span class="text-h5">
<span class="text-h6">
{{ $ay.t("ContractDefaultAdjustments") }}</span
>
</v-col>
@@ -155,16 +165,16 @@
</v-row>
</v-col>
<v-col cols="12" class="mt-5">
<span class="text-h5">
<v-col cols="12" class="mt-10">
<span class="text-h6">
{{ $ay.t("ContractTaggedAdjustments") }}</span
>
</v-col>
<!-- ################################ TAGGED PARTS TABLE ############################### -->
<v-col cols="12" sm="6" lg="4" xl="3">
<span class="text-h6"> {{ $ay.t("PartList") }}</span
<v-col cols="12" sm="6" lg="4" xl="3" class="mb-10">
<span class="text-subtitle-2"> {{ $ay.t("PartList") }}</span
><v-btn icon @click="addContractPartOverrideItem()">
<v-icon color="primary">$ayiPlus</v-icon>
<v-icon small color="primary">$ayiPlus</v-icon>
</v-btn>
<v-simple-table dense>
<template v-slot:default>
@@ -219,10 +229,10 @@
</v-col>
<!-- ################################ TAGGED SERVICE RATES TABLE ############################### -->
<v-col cols="12" sm="6" lg="4" xl="3">
<span class="text-h6"> {{ $ay.t("ServiceRateList") }}</span
<v-col cols="12" sm="6" lg="4" xl="3" class="mb-10">
<span class="text-subtitle-2"> {{ $ay.t("ServiceRateList") }}</span
><v-btn icon @click="addContractServiceRateOverrideItem()">
<v-icon color="primary">$ayiPlus</v-icon>
<v-icon small color="primary">$ayiPlus</v-icon>
</v-btn>
<v-simple-table dense>
<template v-slot:default>
@@ -277,10 +287,10 @@
</v-col>
<!-- ################################ TAGGED TRAVEL RATES TABLE ############################### -->
<v-col cols="12" sm="6" lg="4" xl="3">
<span class="text-h6"> {{ $ay.t("TravelRateList") }}</span
<v-col cols="12" sm="6" lg="4" xl="3" class="mb-10">
<span class="text-subtitle-2"> {{ $ay.t("TravelRateList") }}</span
><v-btn icon @click="addContractTravelRateOverrideItem()">
<v-icon color="primary">$ayiPlus</v-icon>
<v-icon small color="primary">$ayiPlus</v-icon>
</v-btn>
<v-simple-table dense>
<template v-slot:default>
@@ -334,29 +344,30 @@
</v-simple-table>
</v-col>
<!-- ################################ CONTRACT RATES ############################### -->
<v-col cols="12" class="mt-5">
<span class="text-h5"> {{ $ay.t("ContractRateList") }}</span>
<v-col cols="12" class="mt-10">
<span class="text-h6"> {{ $ay.t("ContractRateList") }}</span>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<span class="text-h6"> {{ $ay.t("ServiceRateList") }}</span
<!-- ################################ SERVICE RATES ############################### -->
<v-col cols="12" sm="6" lg="4" xl="3" class="mb-10">
<v-checkbox
v-model="obj.contractServiceRatesOnly"
:readonly="formState.readOnly"
:label="$ay.t('ContractServiceRatesOnly')"
ref="contractServiceRatesOnly"
data-cy="contractServiceRatesOnly"
:error-messages="
form().serverErrors(this, 'contractServiceRatesOnly')
"
@change="fieldValueChanged('contractServiceRatesOnly')"
></v-checkbox>
<span class="text-subtitle-2"> {{ $ay.t("ServiceRateList") }}</span
><v-btn icon @click="addServiceRateItem()">
<v-icon color="primary">$ayiPlus</v-icon>
<v-icon small color="primary">$ayiPlus</v-icon>
</v-btn>
<v-simple-table dense>
<template v-slot:default>
<thead>
<tr>
<th class="text-left">
{{ $ay.t("ServiceRate") }}
</th>
<th class="text-right">
<!-- CONTROL PANEL -->
</th>
</tr>
</thead>
<tbody>
<tr
v-for="(item, index) in obj.serviceRateItems"
@@ -383,20 +394,52 @@
</v-simple-table>
</v-col>
<!--
service rate table here<br />
travel rate table here -->
<v-col cols="12" sm="6" lg="4" xl="3">
<!-- ################################ TRAVEL RATES ############################### -->
<v-col cols="12" sm="6" lg="4" xl="3" class="mb-10">
<v-checkbox
v-model="obj.active"
v-model="obj.contractTravelRatesOnly"
:readonly="formState.readOnly"
:label="$ay.t('Active')"
ref="active"
data-cy="active"
:error-messages="form().serverErrors(this, 'active')"
@change="fieldValueChanged('active')"
:label="$ay.t('ContractTravelRatesOnly')"
ref="contractTravelRatesOnly"
data-cy="contractTravelRatesOnly"
:error-messages="
form().serverErrors(this, 'contractTravelRatesOnly')
"
@change="fieldValueChanged('contractTravelRatesOnly')"
></v-checkbox>
<span class="text-subtitle-2"> {{ $ay.t("TravelRateList") }}</span
><v-btn icon @click="addTravelRateItem()">
<v-icon small color="primary">$ayiPlus</v-icon>
</v-btn>
<v-simple-table dense>
<template v-slot:default>
<tbody>
<tr
v-for="(item, index) in obj.travelRateItems"
:key="item.Id"
>
<td class="text-left">
{{ item.travelRateViz }}
</td>
<td class="text-right">
<v-btn
icon
@click="editTravelRateItem(index)"
class="ml-4"
>
<v-icon>
$ayiEdit
</v-icon>
</v-btn>
</td>
</tr>
</tbody>
</template>
</v-simple-table>
</v-col>
<v-col v-if="form().showMe(this, 'AlertNotes')" cols="12">
<v-textarea
v-model="obj.alertNotes"
@@ -1168,6 +1211,116 @@
</v-dialog>
</v-row>
</template>
<!-- #########################################################################################################-->
<!-- ########################## SERVICE RATE ITEM EDIT FORM ###############################-->
<!-- #########################################################################################################-->
<template
v-if="obj.travelRateItems.length && editTravelRateItemIndex != -1"
>
<v-row justify="center">
<v-dialog v-model="editTravelRateItemDialog">
<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().TravelRate"
:variant="'contractrates'"
:show-edit-icon="true"
v-model="
obj.travelRateItems[editTravelRateItemIndex].travelRateId
"
:readonly="formState.readOnly"
:label="$ay.t('TravelRate')"
ref="userid"
data-cy="userid"
:rules="[
form().integerValid(this, 'TravelRateItems.TravelRateId'),
form().required(this, 'TravelRateItems.TravelRateId')
]"
:error-messages="
form().serverErrors(
this,
`TravelRateItems[${editTravelRateItemIndex}].TravelRateId`
)
"
@input="
fieldValueChanged(
`TravelRateItems[${editTravelRateItemIndex}].TravelRateId`
)
"
:name.sync="
obj.travelRateItems[editTravelRateItemIndex].travelRateViz
"
></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="deleteTravelRateItem()"
>{{ $ay.t("Delete") }}</v-btn
>
<v-spacer></v-spacer>
<v-btn
color="blue darken-1"
text
@click="addTravelRateItem()"
class="ml-4"
>{{ $ay.t("New") }}</v-btn
>
<v-btn
color="blue darken-1"
text
@click="editTravelRateItemDialog = 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="editTravelRateItemDialog = false"
>{{ $ay.t("OK") }}</v-btn
>
<v-btn
class="mt-4"
block
text
color="blue darken-1"
@click="addTravelRateItem()"
>{{ $ay.t("New") }}</v-btn
>
<v-btn
class="mt-8 mb-6"
block
text
color="red darken-1"
@click="deleteTravelRateItem()"
>{{ $ay.t("Delete") }}</v-btn
>
</v-row>
</template>
</v-card-actions>
</v-card>
</v-dialog>
</v-row>
</template>
</div>
</template>
@@ -1448,6 +1601,28 @@ export default {
this.editServiceRateItemIndex = -1;
this.formState.dirty = true;
},
addTravelRateItem: function() {
this.editTravelRateItemIndex =
this.obj.travelRateItems.push({
id: 0,
contractId: this.obj.id,
travelRateId: null
}) - 1;
this.editTravelRateItemDialog = true;
this.formState.dirty = true;
},
editTravelRateItem: function(index) {
this.editTravelRateItemIndex = index;
this.editTravelRateItemDialog = true;
},
deleteTravelRateItem: function() {
this.editTravelRateItemDialog = false;
this.obj.travelRateItems.splice(this.editTravelRateItemIndex, 1);
this.editTravelRateItemIndex = -1;
this.formState.dirty = true;
},
canSave: function() {
return this.formState.valid && this.formState.dirty;
},
@@ -1827,6 +2002,8 @@ async function fetchTranslatedText(vm) {
"ServiceRate",
"TravelRate",
"ContractRateList",
"ContractServiceRatesOnly",
"ContractTravelRatesOnly",
"ContractCustom1",
"ContractCustom2",
"ContractCustom3",