mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Expand edit form.
This commit is contained in:
		| @@ -57,7 +57,6 @@ let transactions = function () { | ||||
|         // transactions are stored in "entries": | ||||
|         entries: [], | ||||
|  | ||||
|  | ||||
|         // state of the form is stored in formState: | ||||
|         formStates: { | ||||
|             loadingCurrencies: true, | ||||
| @@ -74,7 +73,8 @@ let transactions = function () { | ||||
|  | ||||
|         // form behaviour during transaction | ||||
|         formBehaviour: { | ||||
|             formType: 'create', foreignCurrencyEnabled: true, | ||||
|             formType: 'edit', | ||||
|             foreignCurrencyEnabled: true, | ||||
|         }, | ||||
|  | ||||
|         // 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'); | ||||
|         }, | ||||
|  | ||||
|         getTags(index) { | ||||
|             console.log('at get tags ' + index); | ||||
|             console.log(this.entries[index].tags); | ||||
|             return this.entries[index].tags ?? []; | ||||
|         }, | ||||
|  | ||||
|         getTransactionGroup() { | ||||
|             this.entries = []; | ||||
|             const page = window.location.href.split('/'); | ||||
|             const groupId = parseInt(page[page.length - 1]); | ||||
|             const getter = new Get(); | ||||
| @@ -192,34 +197,39 @@ let transactions = function () { | ||||
|                 this.groupProperties.transactionType = data.attributes.transactions[0].type; | ||||
|                 this.groupProperties.title = data.attributes.title ?? data.attributes.transactions[0].description; | ||||
|                 this.entries = parseDownloadedSplits(data.attributes.transactions); | ||||
|                 //console.log(this.entries); | ||||
|  | ||||
|                 // remove waiting thing. | ||||
|                 this.notifications.wait.show = false; | ||||
|             }).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(() => { | ||||
|                     // render tags: | ||||
|                     Tags.init('select.ac-tags', { | ||||
|                         allowClear: true, | ||||
|                         // server: urls.tag, | ||||
|                         // liveServer: true, | ||||
|                         // clearEnd: true, | ||||
|                         selected: [{label:'Bla bla',value:1,selected:true}], | ||||
|                         //allowNew: true, | ||||
|                         //notFoundMessage: i18n.t('firefly.nothing_found'), | ||||
|                         // noCache: true, | ||||
|                         // fetchOptions: { | ||||
|                         //     headers: { | ||||
|                         //         'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content | ||||
|                         //     } | ||||
|                         // } | ||||
|                         server: urls.tag, | ||||
|                         liveServer: true, | ||||
|                         clearEnd: true, | ||||
|                         allowNew: true, | ||||
|                         notFoundMessage: i18n.t('firefly.nothing_found'), | ||||
|                         noCache: true, | ||||
|                         fetchOptions: { | ||||
|                             headers: { | ||||
|                                 'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content | ||||
|                             } | ||||
|                         } | ||||
|                     }); | ||||
|                 }, 250); | ||||
|                 }, 150); | ||||
|             }); | ||||
|         }, | ||||
|  | ||||
|  | ||||
|         init() { | ||||
|             // download translations and get the transaction group. | ||||
|             Promise.all([getVariable('language', 'en_US')]).then((values) => { | ||||
| @@ -282,6 +292,17 @@ let transactions = function () { | ||||
|                 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 = { | ||||
|                 id: download.destination_id, | ||||
|                 name: download.destination_name, | ||||
|                 type: download.destination_type, | ||||
|                 alpine_name: download.destination_name, | ||||
|             }; | ||||
|  | ||||
|             current.source_account = { | ||||
|                 id: download.source_id, | ||||
|                 name: download.source_name, | ||||
|                 type: download.source_type, | ||||
|                 alpine_name: download.source_name, | ||||
|             }; | ||||
|  | ||||
| @@ -87,10 +89,11 @@ export function parseDownloadedSplits(downloads) { | ||||
|             // longitude: null | ||||
|             // piggy_bank_id: null | ||||
|             // zoomLevel: null | ||||
|             console.log('download:'); | ||||
|             console.log(download); | ||||
|             console.log('current:'); | ||||
|             console.log(current); | ||||
|             // console.log('download:'); | ||||
|             // console.log(download); | ||||
|             // console.log('current:'); | ||||
|             // console.log(current); | ||||
|             console.log(current.tags); | ||||
|             returnArray.push(current); | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -10,9 +10,6 @@ | ||||
|             :name="'tags['+index+'][]'" | ||||
|             multiple> | ||||
|             <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> | ||||
| 
 | ||||
|     </div> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user