mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Expand edit form.
This commit is contained in:
parent
f615b9c252
commit
4c30a7bc55
@ -106,7 +106,7 @@ class EditController extends Controller
|
|||||||
$optionalFields['location'] ??= false;
|
$optionalFields['location'] ??= false;
|
||||||
$optionalFields['location'] = $optionalFields['location'] && true === config('firefly.enable_external_map');
|
$optionalFields['location'] = $optionalFields['location'] && true === config('firefly.enable_external_map');
|
||||||
|
|
||||||
// map info:
|
// map info voor v2:
|
||||||
$longitude = config('firefly.default_location.longitude');
|
$longitude = config('firefly.default_location.longitude');
|
||||||
$latitude = config('firefly.default_location.latitude');
|
$latitude = config('firefly.default_location.latitude');
|
||||||
$zoomLevel = config('firefly.default_location.zoom_level');
|
$zoomLevel = config('firefly.default_location.zoom_level');
|
||||||
|
@ -132,6 +132,7 @@ return [
|
|||||||
'has_any_tag' => ['alias' => false, 'needs_context' => false],
|
'has_any_tag' => ['alias' => false, 'needs_context' => false],
|
||||||
'any_notes' => ['alias' => false, 'needs_context' => false],
|
'any_notes' => ['alias' => false, 'needs_context' => false],
|
||||||
'has_any_notes' => ['alias' => true, 'alias_for' => 'any_notes', 'needs_context' => false],
|
'has_any_notes' => ['alias' => true, 'alias_for' => 'any_notes', 'needs_context' => false],
|
||||||
|
'has_notes' => ['alias' => true, 'alias_for' => 'any_notes', 'needs_context' => false],
|
||||||
'any_external_url' => ['alias' => false, 'needs_context' => false],
|
'any_external_url' => ['alias' => false, 'needs_context' => false],
|
||||||
'has_any_external_url' => ['alias' => true, 'alias_for' => 'any_external_url', 'needs_context' => false],
|
'has_any_external_url' => ['alias' => true, 'alias_for' => 'any_external_url', 'needs_context' => false],
|
||||||
'has_no_attachments' => ['alias' => false, 'needs_context' => false],
|
'has_no_attachments' => ['alias' => false, 'needs_context' => false],
|
||||||
|
File diff suppressed because one or more lines are too long
1
public/build/assets/edit-9f80420b.js
Normal file
1
public/build/assets/edit-9f80420b.js
Normal file
File diff suppressed because one or more lines are too long
@ -101,7 +101,7 @@
|
|||||||
"integrity": "sha384-wA/Z8Z+hNOuOA5ZTX8ShykEkdtfxX6dBZFLmmYmanfuUYEeY427OaNi956vrN6cy"
|
"integrity": "sha384-wA/Z8Z+hNOuOA5ZTX8ShykEkdtfxX6dBZFLmmYmanfuUYEeY427OaNi956vrN6cy"
|
||||||
},
|
},
|
||||||
"resources/assets/v2/pages/transactions/edit.js": {
|
"resources/assets/v2/pages/transactions/edit.js": {
|
||||||
"file": "assets/edit-6247ff45.js",
|
"file": "assets/edit-9f80420b.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_get-c53daca3.js",
|
"_get-c53daca3.js",
|
||||||
"_vendor-4332182f.js",
|
"_vendor-4332182f.js",
|
||||||
@ -110,7 +110,7 @@
|
|||||||
],
|
],
|
||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
"src": "resources/assets/v2/pages/transactions/edit.js",
|
"src": "resources/assets/v2/pages/transactions/edit.js",
|
||||||
"integrity": "sha384-hJTbJsS4rExaV2BGHmiZ/J/nm8RicxSfwzr7TDUe/nwtYOm8gWtmNxrDrsmyzAqS"
|
"integrity": "sha384-aDpFfamLQtUwfrOIPa3rZYGluWoOFUl+/HT5HVFqxc2Qa78DCqiUGsw20xsnPH71"
|
||||||
},
|
},
|
||||||
"resources/assets/v2/sass/app.scss": {
|
"resources/assets/v2/sass/app.scss": {
|
||||||
"file": "assets/app-fb7b26ec.css",
|
"file": "assets/app-fb7b26ec.css",
|
||||||
|
@ -57,7 +57,6 @@ let transactions = function () {
|
|||||||
// transactions are stored in "entries":
|
// transactions are stored in "entries":
|
||||||
entries: [],
|
entries: [],
|
||||||
|
|
||||||
|
|
||||||
// state of the form is stored in formState:
|
// state of the form is stored in formState:
|
||||||
formStates: {
|
formStates: {
|
||||||
loadingCurrencies: true,
|
loadingCurrencies: true,
|
||||||
@ -74,7 +73,8 @@ let transactions = function () {
|
|||||||
|
|
||||||
// form behaviour during transaction
|
// form behaviour during transaction
|
||||||
formBehaviour: {
|
formBehaviour: {
|
||||||
formType: 'create', foreignCurrencyEnabled: true,
|
formType: 'edit',
|
||||||
|
foreignCurrencyEnabled: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
// form data (except transactions) is stored in formData
|
// form data (except transactions) is stored in formData
|
||||||
@ -180,9 +180,14 @@ let transactions = function () {
|
|||||||
}
|
}
|
||||||
return formatMoney(this.groupProperties.totalAmount, this.entries[0].currency_code ?? 'EUR');
|
return formatMoney(this.groupProperties.totalAmount, this.entries[0].currency_code ?? 'EUR');
|
||||||
},
|
},
|
||||||
|
getTags(index) {
|
||||||
|
console.log('at get tags ' + index);
|
||||||
|
console.log(this.entries[index].tags);
|
||||||
|
return this.entries[index].tags ?? [];
|
||||||
|
},
|
||||||
|
|
||||||
getTransactionGroup() {
|
getTransactionGroup() {
|
||||||
|
this.entries = [];
|
||||||
const page = window.location.href.split('/');
|
const page = window.location.href.split('/');
|
||||||
const groupId = parseInt(page[page.length - 1]);
|
const groupId = parseInt(page[page.length - 1]);
|
||||||
const getter = new Get();
|
const getter = new Get();
|
||||||
@ -192,34 +197,39 @@ let transactions = function () {
|
|||||||
this.groupProperties.transactionType = data.attributes.transactions[0].type;
|
this.groupProperties.transactionType = data.attributes.transactions[0].type;
|
||||||
this.groupProperties.title = data.attributes.title ?? data.attributes.transactions[0].description;
|
this.groupProperties.title = data.attributes.title ?? data.attributes.transactions[0].description;
|
||||||
this.entries = parseDownloadedSplits(data.attributes.transactions);
|
this.entries = parseDownloadedSplits(data.attributes.transactions);
|
||||||
//console.log(this.entries);
|
|
||||||
|
|
||||||
// remove waiting thing.
|
// remove waiting thing.
|
||||||
this.notifications.wait.show = false;
|
this.notifications.wait.show = false;
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
this.groupProperties.totalAmount = 0;
|
||||||
|
for (let i in this.entries) {
|
||||||
|
if (this.entries.hasOwnProperty(i)) {
|
||||||
|
this.groupProperties.totalAmount = this.groupProperties.totalAmount + parseFloat(this.entries[i].amount);
|
||||||
|
this.filters.source.push(this.entries[i].source_account.type);
|
||||||
|
this.filters.destination.push(this.entries[i].source_account.type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(this.filters);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// render tags:
|
// render tags:
|
||||||
Tags.init('select.ac-tags', {
|
Tags.init('select.ac-tags', {
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
// server: urls.tag,
|
server: urls.tag,
|
||||||
// liveServer: true,
|
liveServer: true,
|
||||||
// clearEnd: true,
|
clearEnd: true,
|
||||||
selected: [{label:'Bla bla',value:1,selected:true}],
|
allowNew: true,
|
||||||
//allowNew: true,
|
notFoundMessage: i18n.t('firefly.nothing_found'),
|
||||||
//notFoundMessage: i18n.t('firefly.nothing_found'),
|
noCache: true,
|
||||||
// noCache: true,
|
fetchOptions: {
|
||||||
// fetchOptions: {
|
headers: {
|
||||||
// headers: {
|
'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content
|
||||||
// 'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
});
|
});
|
||||||
}, 250);
|
}, 150);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
// download translations and get the transaction group.
|
// download translations and get the transaction group.
|
||||||
Promise.all([getVariable('language', 'en_US')]).then((values) => {
|
Promise.all([getVariable('language', 'en_US')]).then((values) => {
|
||||||
@ -282,6 +292,17 @@ let transactions = function () {
|
|||||||
this.entries[event.detail.index].zoomLevel = event.detail.zoomLevel;
|
this.entries[event.detail.index].zoomLevel = event.detail.zoomLevel;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
changedAmount(e) {
|
||||||
|
const index = parseInt(e.target.dataset.index);
|
||||||
|
this.entries[index].amount = parseFloat(e.target.value);
|
||||||
|
this.groupProperties.totalAmount = 0;
|
||||||
|
for (let i in this.entries) {
|
||||||
|
if (this.entries.hasOwnProperty(i)) {
|
||||||
|
this.groupProperties.totalAmount = this.groupProperties.totalAmount + parseFloat(this.entries[i].amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,12 +66,14 @@ export function parseDownloadedSplits(downloads) {
|
|||||||
current.destination_account = {
|
current.destination_account = {
|
||||||
id: download.destination_id,
|
id: download.destination_id,
|
||||||
name: download.destination_name,
|
name: download.destination_name,
|
||||||
|
type: download.destination_type,
|
||||||
alpine_name: download.destination_name,
|
alpine_name: download.destination_name,
|
||||||
};
|
};
|
||||||
|
|
||||||
current.source_account = {
|
current.source_account = {
|
||||||
id: download.source_id,
|
id: download.source_id,
|
||||||
name: download.source_name,
|
name: download.source_name,
|
||||||
|
type: download.source_type,
|
||||||
alpine_name: download.source_name,
|
alpine_name: download.source_name,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -87,10 +89,11 @@ export function parseDownloadedSplits(downloads) {
|
|||||||
// longitude: null
|
// longitude: null
|
||||||
// piggy_bank_id: null
|
// piggy_bank_id: null
|
||||||
// zoomLevel: null
|
// zoomLevel: null
|
||||||
console.log('download:');
|
// console.log('download:');
|
||||||
console.log(download);
|
// console.log(download);
|
||||||
console.log('current:');
|
// console.log('current:');
|
||||||
console.log(current);
|
// console.log(current);
|
||||||
|
console.log(current.tags);
|
||||||
returnArray.push(current);
|
returnArray.push(current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,6 @@
|
|||||||
:name="'tags['+index+'][]'"
|
:name="'tags['+index+'][]'"
|
||||||
multiple>
|
multiple>
|
||||||
<option value="">{{ __('firefly.select_tag') }}</option>
|
<option value="">{{ __('firefly.select_tag') }}</option>
|
||||||
<template x-for="tag in transaction.tags" :key="tag">
|
|
||||||
<option :value="tag" x-text="tag" selected="selected"></option>
|
|
||||||
</template>
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user