This commit is contained in:
2020-02-07 18:43:12 +00:00
parent 1a624323b1
commit f326412df7
4 changed files with 95 additions and 5 deletions

View File

@@ -0,0 +1,79 @@
<template>
<div>
<v-text-field
v-currency="{
currency: currencyName,
locale: languageName
}"
v-model="workingAmount"
:readonly="readOnly"
v-bind:label="label"
v-bind:rules="rules"
v-bind:required="required"
></v-text-field>
<p v-show="error" class="form__error v-messages theme--light error--text">
{{ error }}
</p>
</div>
</template>
<script>
/* Xeslint-disable */
//******************************** NOTE: this control also captures the TIME even though it's DATE only, this is an intentional design decision to support field change to amount or amount AND time and is considered a display issue */
export default {
data: () => ({
amount: null,
oldAmount: null,
currencyName: window.$gz.locale.getCurrencyName(),
languageName: window.$gz.locale.getBrowserFirstLanguage()
}),
props: {
label: String,
rules: Array,
value: String,
required: { type: Boolean, default: false },
readonly: { type: Boolean, default: false },
error: {
type: String,
required: false
}
},
methods: {
lt(ltKey) {
return window.$gz.locale.get(ltKey);
},
locale() {
return window.$gz.locale;
}
},
watch: {
amount() {
//abstract change of value to filter out no change and control when change happens to parent
var hasChanged = false;
if (this.amount != this.oldAmount) {
hasChanged = true;
}
this.oldAmount = this.amount;
if (hasChanged) {
this.$emit("input", this.amount);
this.$emit("change", this.amount);
}
},
value() {
this.amount = this.value;
}
},
computed: {
workingAmount: {
get() {
return this.amount;
},
set(value) {
console.log("STUB: setvalue ");
console.log(value);
//this.amount = parseCurrencyHere(value);
}
}
}
};
</script>