2019-05-29 21:56:39 +02:00
|
|
|
<!--
|
|
|
|
- CustomDate.vue
|
2020-01-25 06:08:56 +01:00
|
|
|
- Copyright (c) 2019 james@firefly-iii.org
|
2019-05-29 21:56:39 +02:00
|
|
|
-
|
2019-10-02 06:43:38 +02:00
|
|
|
- This file is part of Firefly III (https://github.com/firefly-iii).
|
2019-05-29 21:56:39 +02:00
|
|
|
-
|
2019-10-02 06:43:38 +02:00
|
|
|
- This program is free software: you can redistribute it and/or modify
|
|
|
|
- it under the terms of the GNU Affero General Public License as
|
|
|
|
- published by the Free Software Foundation, either version 3 of the
|
|
|
|
- License, or (at your option) any later version.
|
2019-05-29 21:56:39 +02:00
|
|
|
-
|
2019-10-02 06:43:38 +02:00
|
|
|
- This program is distributed in the hope that it will be useful,
|
2019-05-29 21:56:39 +02:00
|
|
|
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2019-10-02 06:43:38 +02:00
|
|
|
- GNU Affero General Public License for more details.
|
2019-05-29 21:56:39 +02:00
|
|
|
-
|
2019-10-02 06:43:38 +02:00
|
|
|
- You should have received a copy of the GNU Affero General Public License
|
|
|
|
- along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2019-05-29 21:56:39 +02:00
|
|
|
-->
|
|
|
|
|
2019-05-12 07:40:24 +02:00
|
|
|
<template>
|
2019-05-24 05:29:04 +02:00
|
|
|
<div class="form-group"
|
|
|
|
v-bind:class="{ 'has-error': hasError()}"
|
|
|
|
>
|
2019-05-12 07:40:24 +02:00
|
|
|
<div class="col-sm-12 text-sm">
|
2019-05-12 13:46:20 +02:00
|
|
|
{{ title }}
|
2019-05-12 07:40:24 +02:00
|
|
|
</div>
|
|
|
|
<div class="col-sm-12">
|
2020-03-13 06:22:50 +01:00
|
|
|
<div class="input-group">
|
2019-05-12 13:46:20 +02:00
|
|
|
<input type="date" class="form-control" :name="name"
|
|
|
|
:title="title" autocomplete="off"
|
|
|
|
ref="date"
|
2019-08-18 09:07:08 +02:00
|
|
|
:value="value ? value.substr(0,10): ''" @input="handleInput"
|
2019-05-12 13:46:20 +02:00
|
|
|
:placeholder="title">
|
2020-03-13 06:22:50 +01:00
|
|
|
<span class="input-group-btn">
|
|
|
|
<button
|
|
|
|
tabIndex="-1"
|
|
|
|
v-on:click="clearDate"
|
|
|
|
class="btn btn-default"
|
|
|
|
type="button"><i class="fa fa-trash-o"></i></button>
|
|
|
|
</span>
|
|
|
|
</div>
|
2019-05-24 05:29:04 +02:00
|
|
|
<ul class="list-unstyled" v-for="error in this.error">
|
|
|
|
<li class="text-danger">{{ error }}</li>
|
|
|
|
</ul>
|
2019-05-12 07:40:24 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2019-05-12 13:46:20 +02:00
|
|
|
name: "CustomDate",
|
|
|
|
props: {
|
|
|
|
value: String,
|
|
|
|
title: String,
|
2019-05-24 05:29:04 +02:00
|
|
|
name: String,
|
|
|
|
error: Array,
|
2019-05-12 13:46:20 +02:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
handleInput(e) {
|
|
|
|
this.$emit('input', this.$refs.date.value);
|
2019-05-24 05:29:04 +02:00
|
|
|
},
|
|
|
|
hasError: function () {
|
|
|
|
return this.error.length > 0;
|
|
|
|
},
|
2020-03-13 06:22:50 +01:00
|
|
|
clearDate: function () {
|
|
|
|
//props.value = '';
|
|
|
|
this.name = '';
|
|
|
|
this.$refs.date.value = '';
|
|
|
|
this.$emit('input', this.$refs.date.value);
|
|
|
|
},
|
2019-05-12 13:46:20 +02:00
|
|
|
}
|
2019-05-12 07:40:24 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
</style>
|