Initial spinner implementation.
This commit is contained in:
parent
0a317093b5
commit
ca7c10a65a
1 changed files with 21 additions and 1 deletions
|
|
@ -36,7 +36,7 @@
|
||||||
:maxlength="maxLength ? maxLength : '999'"
|
:maxlength="maxLength ? maxLength : '999'"
|
||||||
@focus="$emit('focus', $event.target.value)" />
|
@focus="$emit('focus', $event.target.value)" />
|
||||||
<button v-if="includeSearchIcon" type="submit" aria-label="Search button" />
|
<button v-if="includeSearchIcon" type="submit" aria-label="Search button" />
|
||||||
<label class="camera-icon-input" v-if="includeCameraIcon">
|
<label class="camera-icon-input" v-show="includeCameraIcon && !isLoading">
|
||||||
<input
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
id="vin-input"
|
id="vin-input"
|
||||||
|
|
@ -44,6 +44,10 @@
|
||||||
aria-label="Camera icon/button"
|
aria-label="Camera icon/button"
|
||||||
@change="submitImage" />
|
@change="submitImage" />
|
||||||
</label>
|
</label>
|
||||||
|
<loader
|
||||||
|
v-show="includeCameraIcon && isLoading"
|
||||||
|
loaderColor="blue"
|
||||||
|
class="loading-icon"></loader>
|
||||||
</div>
|
</div>
|
||||||
<div v-show="errorMessage" class="row my-2 form-test-error">
|
<div v-show="errorMessage" class="row my-2 form-test-error">
|
||||||
<span class="d-inline-flex mt-0" role="alert">{{ errorMessage }}</span>
|
<span class="d-inline-flex mt-0" role="alert">{{ errorMessage }}</span>
|
||||||
|
|
@ -54,6 +58,8 @@
|
||||||
<script>
|
<script>
|
||||||
import { useField, validate } from "vee-validate";
|
import { useField, validate } from "vee-validate";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
|
import loader from "@/ux-components/loader/loader.vue";
|
||||||
|
import { ref } from "vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "textbox-question",
|
name: "textbox-question",
|
||||||
|
|
@ -89,6 +95,7 @@ export default {
|
||||||
const propsClone = Object.assign({}, props);
|
const propsClone = Object.assign({}, props);
|
||||||
const modelValue = propsClone.modelValue;
|
const modelValue = propsClone.modelValue;
|
||||||
let initialValue;
|
let initialValue;
|
||||||
|
let isLoading = ref(false);
|
||||||
|
|
||||||
switch (typeof modelValue) {
|
switch (typeof modelValue) {
|
||||||
case "number":
|
case "number":
|
||||||
|
|
@ -118,10 +125,12 @@ export default {
|
||||||
validate,
|
validate,
|
||||||
meta,
|
meta,
|
||||||
errors,
|
errors,
|
||||||
|
isLoading,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async submitImage(e) {
|
async submitImage(e) {
|
||||||
|
this.isLoading = true;
|
||||||
await this.dispatchStoreAction(storeActions.LOOKUP_VIN_BY_IMAGE, e.target.files[0])
|
await this.dispatchStoreAction(storeActions.LOOKUP_VIN_BY_IMAGE, e.target.files[0])
|
||||||
.then(async (response) => {
|
.then(async (response) => {
|
||||||
this.value = response.data.length > 0 ? response.data[0] : "";
|
this.value = response.data.length > 0 ? response.data[0] : "";
|
||||||
|
|
@ -134,6 +143,7 @@ export default {
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.$emit("imageLookupError");
|
this.$emit("imageLookupError");
|
||||||
});
|
});
|
||||||
|
this.isLoading = false;
|
||||||
e.target.value = null;
|
e.target.value = null;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -182,6 +192,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
components: {
|
||||||
|
loader,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -238,6 +251,13 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.loading-icon {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
right: 1.5rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
input {
|
input {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue