This commit is contained in:
2020-12-23 23:02:26 +00:00
parent d114d7175b
commit 82749eb98b
10 changed files with 100 additions and 112 deletions

View File

@@ -6,17 +6,6 @@
MISC ITEMS THAT CAME UP
todo: time picker no way to select NOW
todo: time picker defaults to 12:00am when date is selected, how about current time instead?
todo: date picker component add drop down quick pick:
i.e. Hour from now, Day from now, Week from now, Month from now.
todo: datetime picker read only mode is grayed out, should not be?
probably still setting both readonly and disabled like old times
todo: Server returned broken rules not showing in form beside the field in Question
test on widget form to confirm
todo: incorrect creds on login get "res is not defined" instead of proper error

View File

@@ -38,7 +38,6 @@
:value="readonlyFormat()"
:label="label"
readonly
disabled
prepend-icon="$ayiCalendarAlt"
></v-text-field>
<p v-show="error" class="form__error v-messages theme--light error--text">

View File

@@ -19,7 +19,6 @@
:value="readonlyFormat()"
:label="label"
readonly
disabled
></v-text-field>
</template>
</div>

View File

@@ -1,87 +1,92 @@
<template>
<v-row>
<template v-if="!readonly">
<v-col xs6>
<v-dialog v-model="dlgdate" width="290px">
<template v-slot:activator="{ on }">
<v-text-field
v-on="on"
prepend-icon="$ayiCalendarAlt"
@click:prepend="dlgdate = true"
:value="dateValue"
v-bind:label="label"
v-bind:rules="rules"
readonly
:error="!!error"
:data-cy="'dtfpick:' + testId"
></v-text-field>
</template>
<v-date-picker
:value="dateValue"
@input="updateDateValue"
:locale="defaultLocale"
:data-cy="'dpick:' + testId"
>
<v-btn text color="primary" @click="$emit('input', null)">{{
$ay.t("Delete")
}}</v-btn>
<v-spacer></v-spacer>
<v-btn text color="primary" @click="dlgdate = false">{{
$ay.t("OK")
}}</v-btn>
</v-date-picker>
</v-dialog>
</v-col>
<v-col xs6>
<v-dialog v-model="dlgtime" width="300px">
<template v-slot:activator="{ on }">
<v-text-field
v-on="on"
:value="readonlyTimeFormat()"
label
prepend-icon="$ayiClock"
@click:prepend="dlgtime = true"
readonly
:error="!!error"
:data-cy="'ttfpick:' + testId"
></v-text-field>
</template>
<v-time-picker
scrollable
ampm-in-title
:format="hour12 ? 'ampm' : '24hr'"
:value="timeValue"
@input="updateTimeValue"
:data-cy="'tpick:' + testId"
>
<v-btn text color="primary" @click="$emit('input', null)">{{
$ay.t("Delete")
}}</v-btn>
<v-spacer></v-spacer>
<v-btn text color="primary" @click="setNow()">{{
$ay.t("Now")
}}</v-btn>
<v-spacer></v-spacer>
<v-btn text color="primary" @click="dlgtime = false">{{
$ay.t("OK")
}}</v-btn>
</v-time-picker>
</v-dialog>
</v-col>
</template>
<template v-else>
<v-text-field
:value="readonlyFormat()"
:label="label"
readonly
disabled
prepend-icon="$ayiCalendarAlt"
></v-text-field>
<p v-show="error" class="form__error v-messages theme--light error--text">
{{ error }}
</p>
</template>
</v-row>
<div>
<div>
<v-row>
<template v-if="!readonly">
<v-col xs6>
<v-dialog v-model="dlgdate" width="290px">
<template v-slot:activator="{ on }">
<v-text-field
v-on="on"
prepend-icon="$ayiCalendarAlt"
@click:prepend="dlgdate = true"
:value="dateValue"
v-bind:label="label"
v-bind:rules="rules"
readonly
:error="!!hasErrors"
:data-cy="'dtfpick:' + testId"
></v-text-field>
</template>
<v-date-picker
:value="dateValue"
@input="updateDateValue"
:locale="defaultLocale"
:data-cy="'dpick:' + testId"
>
<v-btn text color="primary" @click="$emit('input', null)">{{
$ay.t("Delete")
}}</v-btn>
<v-spacer></v-spacer>
<v-btn text color="primary" @click="dlgdate = false">{{
$ay.t("OK")
}}</v-btn>
</v-date-picker>
</v-dialog>
</v-col>
<v-col xs6>
<v-dialog v-model="dlgtime" width="300px">
<template v-slot:activator="{ on }">
<v-text-field
v-on="on"
:value="readonlyTimeFormat()"
label
prepend-icon="$ayiClock"
@click:prepend="dlgtime = true"
readonly
:error="!!hasErrors"
:data-cy="'ttfpick:' + testId"
></v-text-field>
</template>
<v-time-picker
scrollable
ampm-in-title
:format="hour12 ? 'ampm' : '24hr'"
:value="timeValue"
@input="updateTimeValue"
:data-cy="'tpick:' + testId"
>
<v-btn text color="primary" @click="$emit('input', null)">{{
$ay.t("Delete")
}}</v-btn>
<v-spacer></v-spacer>
<v-btn text color="primary" @click="setNow()">{{
$ay.t("Now")
}}</v-btn>
<v-spacer></v-spacer>
<v-btn text color="primary" @click="dlgtime = false">{{
$ay.t("OK")
}}</v-btn>
</v-time-picker>
</v-dialog>
</v-col>
</template>
<template v-else>
<v-text-field
:value="readonlyFormat()"
:label="label"
readonly
prepend-icon="$ayiCalendarAlt"
></v-text-field>
</template>
</v-row>
</div>
<div class="v-messages theme--light error--text mt-n5" role="alert">
<div class="v-messages__wrapper">
<div class="v-messages__message">{{ allErrors() }}</div>
</div>
</div>
</div>
</template>
<script>
/* Xeslint-disable */
@@ -98,17 +103,16 @@ export default {
props: {
label: String,
rules: Array,
"error-messages": { type: Array, default: null },
errorMessages: { type: Array, default: null },
value: String,
readonly: { type: Boolean, default: false },
disabled: { type: Boolean, default: false },
error: {
type: String,
required: false
},
testId: String
},
computed: {
hasErrors() {
return this.errorMessages != null && this.errorMessages.length > 0;
},
timeValue() {
return window.$gz.locale.utcDateStringToLocal8601TimeOnlyString(
this.value,
@@ -130,9 +134,7 @@ export default {
},
allErrors() {
let ret = "";
if (this.error != null) {
ret = this.error;
}
if (this.errorMessages != null && this.errorMessages.length > 0) {
ret += this.errorMessages.toString();
}

View File

@@ -32,7 +32,6 @@
:value="readonlyFormat()"
:label="label"
readonly
disabled
></v-text-field>
</template>
</v-row>

View File

@@ -42,7 +42,6 @@
:value="readonlyFormat()"
:label="label"
prepend-icon="$ayiClock"
disabled
readonly
></v-text-field>
<p v-show="error" class="form__error v-messages theme--light error--text">

View File

@@ -19,7 +19,6 @@
:value="readonlyFormat()"
:label="label"
readonly
disabled
></v-text-field>
</template>
</div>

View File

@@ -152,7 +152,6 @@
:label="$ay.t('LastLogin')"
v-model="obj.lastLogin"
readonly
disabled
ref="lastLogin"
testId="lastLogin"
></gz-date-time-picker>

View File

@@ -142,7 +142,6 @@
:label="$ay.t('LastLogin')"
v-model="obj.lastLogin"
readonly
disabled
ref="lastLogin"
testId="lastLogin"
></gz-date-time-picker>

View File

@@ -50,7 +50,8 @@
ref="count"
data-cy="count"
:rules="[form().integerValid(this, 'count')]"
:error-messages="form().serverErrors(this, 'count')"
:error-messages="['blah', 'blah2']"
:serror-messages="form().serverErrors(this, 'count')"
@input="fieldValueChanged('count')"
type="number"
></v-text-field>
@@ -85,11 +86,14 @@
:readonly="formState.readOnly"
ref="startDate"
testId="startDate"
:error-messages="form().serverErrors(this, 'startDate')"
:error-messages="[
'blah',
'blah2 teh quick brown fox jumped over teh six lazy dogs'
]"
@input="fieldValueChanged('startDate')"
></gz-date-time-picker>
</v-col>
<!-- :error-messages="form().serverErrors(this, 'startDate')" -->
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-date-time-picker
:label="$ay.t('WidgetEndDate')"