mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 02:26:58 +00:00
Include correct URI for transaction autocomplete [skip ci]
This commit is contained in:
@@ -48,12 +48,9 @@ class ApiDemoUser
|
|||||||
if (null === $user) {
|
if (null === $user) {
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
if ($user->hasRole('demo')) {
|
||||||
/** @var UserRepositoryInterface $repository */
|
|
||||||
$repository = app(UserRepositoryInterface::class);
|
|
||||||
|
|
||||||
if ($repository->hasRole($user, 'demo')) {
|
|
||||||
return response('', 403);
|
return response('', 403);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
2
public/v1/js/create_transaction.js
vendored
2
public/v1/js/create_transaction.js
vendored
File diff suppressed because one or more lines are too long
2
public/v1/js/edit_transaction.js
vendored
2
public/v1/js/edit_transaction.js
vendored
File diff suppressed because one or more lines are too long
@@ -19,104 +19,112 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="form-group" v-bind:class="{ 'has-error': hasError()}">
|
<div class="form-group" v-bind:class="{ 'has-error': hasError()}">
|
||||||
<div class="col-sm-12 text-sm">
|
<div class="col-sm-12 text-sm">
|
||||||
{{ $t('firefly.description') }}
|
{{ $t('firefly.description') }}
|
||||||
</div>
|
|
||||||
<div class="col-sm-12">
|
|
||||||
<div class="input-group">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
class="form-control"
|
|
||||||
name="description[]"
|
|
||||||
:title="$t('firefly.description')"
|
|
||||||
v-on:keypress="handleEnter"
|
|
||||||
v-on:submit.prevent
|
|
||||||
ref="descr"
|
|
||||||
autocomplete="off"
|
|
||||||
v-bind:placeholder="$t('firefly.description')"
|
|
||||||
:value="value" @input="handleInput"
|
|
||||||
>
|
|
||||||
<span class="input-group-btn">
|
|
||||||
<button
|
|
||||||
v-on:click="clearDescription"
|
|
||||||
tabIndex="-1"
|
|
||||||
class="btn btn-default"
|
|
||||||
type="button"><i class="fa fa-trash-o"></i></button>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<typeahead
|
|
||||||
:open-on-empty=true
|
|
||||||
:open-on-focus=true
|
|
||||||
v-on:input="selectedItem"
|
|
||||||
:async-src="descriptionAutoCompleteURI"
|
|
||||||
v-model="name"
|
|
||||||
:target="target"
|
|
||||||
item-key="description"
|
|
||||||
></typeahead>
|
|
||||||
<ul class="list-unstyled" v-for="error in this.error">
|
|
||||||
<li class="text-danger">{{ error }}</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<div class="input-group">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="form-control"
|
||||||
|
name="description[]"
|
||||||
|
:title="$t('firefly.description')"
|
||||||
|
v-on:keypress="handleEnter"
|
||||||
|
v-on:submit.prevent
|
||||||
|
ref="descr"
|
||||||
|
autocomplete="off"
|
||||||
|
v-bind:placeholder="$t('firefly.description')"
|
||||||
|
:value="value" @input="handleInput"
|
||||||
|
>
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<button
|
||||||
|
v-on:click="clearDescription"
|
||||||
|
tabIndex="-1"
|
||||||
|
class="btn btn-default"
|
||||||
|
type="button"><i class="fa fa-trash-o"></i></button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<typeahead
|
||||||
|
:open-on-empty=true
|
||||||
|
:open-on-focus=true
|
||||||
|
v-on:input="selectedItem"
|
||||||
|
:async-function="aSyncFunction"
|
||||||
|
v-model="name"
|
||||||
|
:target="target"
|
||||||
|
item-key="description"
|
||||||
|
></typeahead>
|
||||||
|
<ul class="list-unstyled" v-for="error in this.error">
|
||||||
|
<li class="text-danger">{{ error }}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
props: ['error', 'value', 'index'],
|
props: ['error', 'value', 'index'],
|
||||||
name: "TransactionDescription",
|
name: "TransactionDescription",
|
||||||
mounted() {
|
mounted() {
|
||||||
this.target = this.$refs.descr;
|
this.target = this.$refs.descr;
|
||||||
this.descriptionAutoCompleteURI = document.getElementsByTagName('base')[0].href + "api/v1/autocomplete/transactions?query=";
|
this.descriptionAutoCompleteURI = document.getElementsByTagName('base')[0].href + "api/v1/autocomplete/transactions?query=";
|
||||||
this.$refs.descr.focus();
|
this.$refs.descr.focus();
|
||||||
},
|
},
|
||||||
components: {
|
components: {},
|
||||||
},
|
data() {
|
||||||
data() {
|
return {
|
||||||
return {
|
descriptionAutoCompleteURI: null,
|
||||||
descriptionAutoCompleteURI: null,
|
name: null,
|
||||||
name: null,
|
description: null,
|
||||||
description: null,
|
target: null,
|
||||||
target: null,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
search: function(input) {
|
|
||||||
return ['ab','cd'];
|
|
||||||
},
|
|
||||||
hasError: function () {
|
|
||||||
return this.error.length > 0;
|
|
||||||
},
|
|
||||||
clearDescription: function () {
|
|
||||||
//props.value = '';
|
|
||||||
this.description = '';
|
|
||||||
this.$refs.descr.value = '';
|
|
||||||
this.$emit('input', this.$refs.descr.value);
|
|
||||||
// some event?
|
|
||||||
this.$emit('clear:description')
|
|
||||||
},
|
|
||||||
handleInput(e) {
|
|
||||||
this.$emit('input', this.$refs.descr.value);
|
|
||||||
},
|
|
||||||
handleEnter: function (e) {
|
|
||||||
// todo feels sloppy
|
|
||||||
|
|
||||||
if (e.keyCode === 13) {
|
|
||||||
//e.preventDefault();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selectedItem: function (e) {
|
|
||||||
if (typeof this.name === 'undefined') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (typeof this.name === 'string') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.$refs.descr.value = this.name.description;
|
|
||||||
this.$emit('input', this.$refs.descr.value);
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
aSyncFunction: function (query, done) {
|
||||||
|
axios.get(this.descriptionAutoCompleteURI + query)
|
||||||
|
.then(res => {
|
||||||
|
done(res.data);
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
// any error handler
|
||||||
|
})
|
||||||
|
},
|
||||||
|
search: function (input) {
|
||||||
|
return ['ab', 'cd'];
|
||||||
|
},
|
||||||
|
hasError: function () {
|
||||||
|
return this.error.length > 0;
|
||||||
|
},
|
||||||
|
clearDescription: function () {
|
||||||
|
//props.value = '';
|
||||||
|
this.description = '';
|
||||||
|
this.$refs.descr.value = '';
|
||||||
|
this.$emit('input', this.$refs.descr.value);
|
||||||
|
// some event?
|
||||||
|
this.$emit('clear:description')
|
||||||
|
},
|
||||||
|
handleInput(e) {
|
||||||
|
this.$emit('input', this.$refs.descr.value);
|
||||||
|
},
|
||||||
|
handleEnter: function (e) {
|
||||||
|
// todo feels sloppy
|
||||||
|
|
||||||
|
if (e.keyCode === 13) {
|
||||||
|
//e.preventDefault();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selectedItem: function (e) {
|
||||||
|
if (typeof this.name === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (typeof this.name === 'string') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$refs.descr.value = this.name.description;
|
||||||
|
this.$emit('input', this.$refs.descr.value);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
Reference in New Issue
Block a user