mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Enable clone transaction (after a fashion)
This commit is contained in:
2
public/v1/js/app.js
vendored
2
public/v1/js/app.js
vendored
File diff suppressed because one or more lines are too long
1
public/v1/js/ff/transactions/show.js
vendored
1
public/v1/js/ff/transactions/show.js
vendored
@@ -26,6 +26,7 @@ $(function () {
|
||||
$('#linkJournalModal').on('shown.bs.modal', function () {
|
||||
makeAutoComplete();
|
||||
})
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
|
||||
function getLinkModal(e) {
|
||||
|
@@ -181,6 +181,12 @@
|
||||
After updating, return here to continue editing.
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input v-model="storeAsNew" name="store_as_new" type="checkbox">
|
||||
Store as a new transaction instead of updating.
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<div class="btn-group">
|
||||
@@ -579,31 +585,30 @@
|
||||
return currentArray;
|
||||
},
|
||||
submit: function (e) {
|
||||
// console.log('I am submit');
|
||||
const page = window.location.href.split('/');
|
||||
const groupId = page[page.length - 1];
|
||||
const uri = './api/v1/transactions/' + groupId + '?_token=' + document.head.querySelector('meta[name="csrf-token"]').content;
|
||||
let uri = './api/v1/transactions/' + groupId + '?_token=' + document.head.querySelector('meta[name="csrf-token"]').content;
|
||||
let method = 'PUT';
|
||||
if (this.storeAsNew) {
|
||||
// other links.
|
||||
uri = './api/v1/transactions?_token=' + document.head.querySelector('meta[name="csrf-token"]').content;
|
||||
method = 'POST';
|
||||
}
|
||||
const data = this.convertData();
|
||||
|
||||
let button = $(e.currentTarget);
|
||||
button.prop("disabled", true);
|
||||
|
||||
axios.put(uri, data)
|
||||
.then(response => {
|
||||
//axios.put(uri, data)
|
||||
axios({
|
||||
method: method,
|
||||
url: uri,
|
||||
data: data,
|
||||
}).then(response => {
|
||||
|
||||
if (0 === this.collectAttachmentData(response)) {
|
||||
this.redirectUser(response.data.data.id, button);
|
||||
}
|
||||
|
||||
// if (this.returnAfter) {
|
||||
// this.setDefaultErrors();
|
||||
// // do message:
|
||||
// this.success_message = '<a href="transactions/show/' + response.data.data.id + '">The transaction</a> has been updated.';
|
||||
// this.error_message = '';
|
||||
// button.prop("disabled", false);
|
||||
// } else {
|
||||
// window.location.href = 'transactions/show/' + response.data.data.id + '?message=updated';
|
||||
// }
|
||||
}).catch(error => {
|
||||
// give user errors things back.
|
||||
// something something render errors.
|
||||
@@ -622,12 +627,21 @@
|
||||
|
||||
if (this.returnAfter) {
|
||||
this.setDefaultErrors();
|
||||
// do message:
|
||||
this.success_message = '<a href="transactions/show/' + groupId + '">The transaction</a> has been updated.';
|
||||
this.error_message = '';
|
||||
// do message if update or new:
|
||||
if (this.storeAsNew) {
|
||||
this.success_message = '<a href="transactions/show/' + groupId + '">Transaction #' + groupId + '</a> has been created.';
|
||||
this.error_message = '';
|
||||
} else {
|
||||
this.success_message = '<a href="transactions/show/' + groupId + '">The transaction</a> has been updated.';
|
||||
this.error_message = '';
|
||||
}
|
||||
button.prop("disabled", false);
|
||||
} else {
|
||||
window.location.href = window.previousUri + '?transaction_group_id=' + groupId+ '&message=updated';
|
||||
if (this.storeAsNew) {
|
||||
window.location.href = window.previousUri + '?transaction_group_id=' + groupId + '&message=created';
|
||||
} else {
|
||||
window.location.href = window.previousUri + '?transaction_group_id=' + groupId + '&message=updated';
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -901,6 +915,7 @@
|
||||
transactions: [],
|
||||
group_title: "",
|
||||
returnAfter: false,
|
||||
storeAsNew: false,
|
||||
transactionType: null,
|
||||
group_title_errors: [],
|
||||
resetButtonDisabled: true,
|
||||
|
@@ -58,6 +58,7 @@ return [
|
||||
'no_rules_for_bill' => 'This bill has no rules associated to it.',
|
||||
'go_to_asset_accounts' => 'View your asset accounts',
|
||||
'go_to_budgets' => 'Go to your budgets',
|
||||
'clone_instructions' => 'To clone a transaction, search for the "store as new" checkbox in the edit screen',
|
||||
'go_to_categories' => 'Go to your categories',
|
||||
'go_to_bills' => 'Go to your bills',
|
||||
'go_to_expense_accounts' => 'See your expense accounts',
|
||||
|
@@ -62,6 +62,7 @@
|
||||
|
||||
{% if groupArray.transactions[0].type != 'opening balance' and groupArray.transactions[0].type != 'reconciliation' %}
|
||||
<!--CLONE-->
|
||||
<a href="#" class="btn btn-default" style="white-space: nowrap;" onclick="return false;" data-toggle="tooltip" data-placement="top" title="{{ 'clone_instructions' |_|escape}}">Clone</a>
|
||||
{#<a href="{{ route('transactions.clone', [transactionGroup.id]) }}" class="btn btn-default"><i class="fa fa-copy"></i> {{ 'clone'|_ }}</a>#}
|
||||
{% endif %}
|
||||
{#
|
||||
|
Reference in New Issue
Block a user