Make list grouped.

This commit is contained in:
James Cole
2020-06-27 13:32:40 +02:00
parent e1fbdca5c1
commit 3e8a4d55ef
28 changed files with 144 additions and 61 deletions

View File

@@ -391,6 +391,7 @@ class AutoCompleteController extends Controller
foreach ($piggies as $piggy) {
$currency = $accountRepos->getAccountCurrency($piggy->account) ?? $defaultCurrency;
$currentAmount = $repository->getRepetition($piggy)->currentamount ?? '0';
$piggy->objectGroup = $piggy->objectGroups->first();
$piggy->name_with_amount = sprintf(
'%s (%s / %s)',
$piggy->name,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -831,11 +831,11 @@
selectedSourceAccount: function (index, model) {
console.log('Now in selectedSourceAccount()');
if (typeof model === 'string') {
console.log('model is string.')
//console.log('model is string.')
// cant change types, only name.
this.transactions[index].source_account.name = model;
} else {
console.log('model is NOT string.')
//console.log('model is NOT string.')
this.transactions[index].source_account = {
id: model.id,
name: model.name,

View File

@@ -17,14 +17,19 @@
- 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/>.
-->
<template>
<div class="form-group"
v-bind:class="{ 'has-error': hasError()}"
v-if="typeof this.transactionType !== 'undefined' && this.transactionType === 'Transfer'">
<div class="col-sm-12 text-sm">
{{ $t('firefly.piggy_bank') }}
</div>
<div class="col-sm-12">
<select name="piggy_bank[]" ref="piggy" @input="handleInput" class="form-control" v-if="this.piggies.length > 0">
<option v-for="piggy in this.piggies" :label="piggy.name_with_amount" :value="piggy.id">{{piggy.name_with_amount}}</option>
<select name="piggy_bank[]" ref="piggy" @input="handleInput" class="form-control">
<optgroup v-for="(option, key) in this.piggies" v-bind:label="key">
<option v-for="piggy in option.piggies" :label="piggy.name_with_amount" :value="piggy.id">{{piggy.name_with_amount}}</option>
</optgroup>
</select>
<ul class="list-unstyled" v-for="error in this.error">
<li class="text-danger">{{ error }}</li>
@@ -55,17 +60,52 @@
loadPiggies: function () {
let URI = document.getElementsByTagName('base')[0].href + "json/piggy-banks";
axios.get(URI, {}).then((res) => {
this.piggies = [
let tempList = {
0: {
group: {
title: this.$t('firefly.default_group_title_name')
},
piggies: [
{
name_with_amount: this.no_piggy_bank,
id: 0,
}
];
],
}
};
for (const key in res.data) {
if (res.data.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
// add to temp list
let currentPiggy = res.data[key];
if (currentPiggy.objectGroup) {
let groupOrder = currentPiggy.objectGroup.order;
if (!tempList[groupOrder]) {
tempList[groupOrder] = {
group: {
title: currentPiggy.objectGroup.title
},
piggies: [],
};
}
tempList[groupOrder].piggies.push({name_with_amount: currentPiggy.name_with_amount, id: currentPiggy.id});
}
if (!currentPiggy.objectGroup) {
// add to empty one:
tempList[0].piggies.push({name_with_amount: currentPiggy.name_with_amount, id: currentPiggy.id});
}
//console.log(currentPiggy);
this.piggies.push(res.data[key]);
}
}
const ordered = {};
Object.keys(tempList).sort().forEach(function(key) {
let groupName = tempList[key].group.title;
ordered[groupName] = tempList[key];
});
// final list:
this.piggies = ordered;
console.log(ordered);
});
}
}

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Create new token",
"profile_create_token": "Create token",
"profile_create": "Create",
"profile_save_changes": "Save changes"
"profile_save_changes": "Save changes",
"default_group_title_name": "(ungrouped)",
"piggy_bank": "Pokladni\u010dka"
},
"form": {
"interest_date": "\u00darokov\u00e9 datum",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Neuen Schl\u00fcssel erstellen",
"profile_create_token": "Schl\u00fcssel erstellen",
"profile_create": "Erstellen",
"profile_save_changes": "\u00c4nderungen speichern"
"profile_save_changes": "\u00c4nderungen speichern",
"default_group_title_name": "(ohne Gruppierung)",
"piggy_bank": "Sparschwein"
},
"form": {
"interest_date": "Zinstermin",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Create new token",
"profile_create_token": "Create token",
"profile_create": "Create",
"profile_save_changes": "Save changes"
"profile_save_changes": "Save changes",
"default_group_title_name": "(ungrouped)",
"piggy_bank": "\u039a\u03bf\u03c5\u03bc\u03c0\u03b1\u03c1\u03ac\u03c2"
},
"form": {
"interest_date": "\u0397\u03bc\u03b5\u03c1\u03bf\u03bc\u03b7\u03bd\u03af\u03b1 \u03c4\u03bf\u03ba\u03b9\u03c3\u03bc\u03bf\u03cd",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Create new token",
"profile_create_token": "Create token",
"profile_create": "Create",
"profile_save_changes": "Save changes"
"profile_save_changes": "Save changes",
"default_group_title_name": "(ungrouped)",
"piggy_bank": "Piggy bank"
},
"form": {
"interest_date": "Interest date",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Crear nuevo token",
"profile_create_token": "Crear token",
"profile_create": "Crear",
"profile_save_changes": "Guardar cambios"
"profile_save_changes": "Guardar cambios",
"default_group_title_name": "(ungrouped)",
"piggy_bank": "Alcanc\u00eda"
},
"form": {
"interest_date": "Fecha de inter\u00e9s",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Create new token",
"profile_create_token": "Create token",
"profile_create": "Luo",
"profile_save_changes": "Save changes"
"profile_save_changes": "Save changes",
"default_group_title_name": "(ryhmittelem\u00e4tt\u00f6m\u00e4t)",
"piggy_bank": "S\u00e4\u00e4st\u00f6possu"
},
"form": {
"interest_date": "Korkop\u00e4iv\u00e4",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Cr\u00e9er un nouveau jeton",
"profile_create_token": "Cr\u00e9er un jeton",
"profile_create": "Cr\u00e9er",
"profile_save_changes": "Enregistrer les modifications"
"profile_save_changes": "Enregistrer les modifications",
"default_group_title_name": "(Sans groupement)",
"piggy_bank": "Tirelire"
},
"form": {
"interest_date": "Date de valeur (int\u00e9r\u00eats)",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Create new token",
"profile_create_token": "Create token",
"profile_create": "Create",
"profile_save_changes": "Save changes"
"profile_save_changes": "Save changes",
"default_group_title_name": "(ungrouped)",
"piggy_bank": "Malacpersely"
},
"form": {
"interest_date": "Kamatfizet\u00e9si id\u0151pont",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Create new token",
"profile_create_token": "Create token",
"profile_create": "Create",
"profile_save_changes": "Save changes"
"profile_save_changes": "Save changes",
"default_group_title_name": "(ungrouped)",
"piggy_bank": "Celengan"
},
"form": {
"interest_date": "Tanggal bunga",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Crea nuovo token",
"profile_create_token": "Crea token",
"profile_create": "Crea",
"profile_save_changes": "Salva modifiche"
"profile_save_changes": "Salva modifiche",
"default_group_title_name": "(non in un gruppo)",
"piggy_bank": "Salvadanaio"
},
"form": {
"interest_date": "Data interesse",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Create new token",
"profile_create_token": "Create token",
"profile_create": "Create",
"profile_save_changes": "Save changes"
"profile_save_changes": "Save changes",
"default_group_title_name": "(ungrouped)",
"piggy_bank": "Sparegris"
},
"form": {
"interest_date": "Rentedato",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Nieuwe token aanmaken",
"profile_create_token": "Token aanmaken",
"profile_create": "Cre\u00ebr",
"profile_save_changes": "Aanpassingen opslaan"
"profile_save_changes": "Aanpassingen opslaan",
"default_group_title_name": "(ongegroepeerd)",
"piggy_bank": "Spaarpotje"
},
"form": {
"interest_date": "Rentedatum",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Create new token",
"profile_create_token": "Create token",
"profile_create": "Create",
"profile_save_changes": "Save changes"
"profile_save_changes": "Save changes",
"default_group_title_name": "(bez grupy)",
"piggy_bank": "Skarbonka"
},
"form": {
"interest_date": "Data odsetek",

View File

@@ -5,7 +5,7 @@
"flash_success": "Sucesso!",
"close": "Fechar",
"split_transaction_title": "Descri\u00e7\u00e3o da transa\u00e7\u00e3o dividida",
"errors_submission": "There was something wrong with your submission. Please check out the errors below.",
"errors_submission": "Tem alguma coisa de errada com o seu envio. Por favor, cheque os erros abaixo.",
"split": "Dividir",
"transaction_stored_link": "<a href=\"transactions\/show\/{ID}\">Transa\u00e7\u00e3o #{ID} (\"{title}\")<\/a> foi salva.",
"transaction_updated_link": "<a href=\"transactions\/show\/{ID}\">Transa\u00e7\u00e3o #{ID}<\/a> foi atualizada.",
@@ -13,12 +13,12 @@
"transaction_journal_information": "Informa\u00e7\u00e3o da transa\u00e7\u00e3o",
"no_budget_pointer": "Parece que voc\u00ea ainda n\u00e3o tem or\u00e7amentos. Voc\u00ea deve criar alguns na p\u00e1gina de <a href=\"\/budgets\">or\u00e7amentos<\/a>. Or\u00e7amentos podem ajud\u00e1-lo a manter o controle das despesas.",
"source_account": "Conta origem",
"hidden_fields_preferences": "You can enable more transaction options in your <a href=\"\/preferences\">settings<\/a>.",
"hidden_fields_preferences": "Voc\u00ea pode ativar mais op\u00e7\u00f5es de transa\u00e7\u00f5es em suas <a href=\"\/preferences\">configura\u00e7\u00f5es<\/a>.",
"destination_account": "Conta destino",
"add_another_split": "Adicionar outra divis\u00e3o",
"submission": "Submission",
"create_another": "After storing, return here to create another one.",
"reset_after": "Reset form after submission",
"submission": "Envio",
"create_another": "Depois de armazenar, retorne aqui para criar outro.",
"reset_after": "Resetar o formul\u00e1rio ap\u00f3s o envio",
"submit": "Enviar",
"amount": "Valor",
"date": "Data",
@@ -28,37 +28,37 @@
"attachments": "Anexos",
"notes": "Notas",
"update_transaction": "Atualizar transa\u00e7\u00e3o",
"after_update_create_another": "After updating, return here to continue editing.",
"after_update_create_another": "Depois de atualizar, retorne aqui para continuar editando.",
"store_as_new": "Store as a new transaction instead of updating.",
"split_title_help": "Se voc\u00ea criar uma transa\u00e7\u00e3o dividida, \u00e9 necess\u00e1rio haver uma descri\u00e7\u00e3o global para todas as partes da transa\u00e7\u00e3o.",
"none_in_select_list": "(nenhum)",
"no_piggy_bank": "(nenhum cofrinho)",
"description": "Descri\u00e7\u00e3o",
"split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction.",
"split_transaction_title_help": "Se voc\u00ea criar uma transa\u00e7\u00e3o dividida, deve haver uma descri\u00e7\u00e3o global para todas as partes da transa\u00e7\u00e3o.",
"destination_account_reconciliation": "Voc\u00ea n\u00e3o pode editar a conta de origem de uma transa\u00e7\u00e3o de reconcilia\u00e7\u00e3o.",
"source_account_reconciliation": "Voc\u00ea n\u00e3o pode editar a conta de origem de uma transa\u00e7\u00e3o de reconcilia\u00e7\u00e3o.",
"budget": "Or\u00e7amento",
"you_create_withdrawal": "You're creating a withdrawal.",
"you_create_transfer": "You're creating a transfer.",
"you_create_deposit": "You're creating a deposit.",
"you_create_withdrawal": "Voc\u00ea est\u00e1 criando uma retirada.",
"you_create_transfer": "Voc\u00ea est\u00e1 criando uma transfer\u00eancia.",
"you_create_deposit": "Voc\u00ea est\u00e1 criando um deposito.",
"edit": "Editar",
"delete": "Apagar",
"name": "Nome",
"profile_whoops": "Ops!",
"profile_something_wrong": "Alguma coisa deu errado!",
"profile_try_again": "Something went wrong. Please try again.",
"profile_oauth_clients": "OAuth Clients",
"profile_oauth_no_clients": "You have not created any OAuth clients.",
"profile_oauth_clients": "Clientes OAuth",
"profile_oauth_no_clients": "Voc\u00ea n\u00e3o criou nenhum cliente OAuth.",
"profile_oauth_clients_header": "Clientes",
"profile_oauth_client_id": "Client ID",
"profile_oauth_client_name": "Nome",
"profile_oauth_client_secret": "Segredo",
"profile_oauth_create_new_client": "Create New Client",
"profile_oauth_create_client": "Create Client",
"profile_oauth_create_new_client": "Criar um novo cliente",
"profile_oauth_create_client": "Criar um cliente",
"profile_oauth_edit_client": "Edit Client",
"profile_oauth_name_help": "Something your users will recognize and trust.",
"profile_oauth_redirect_url": "Redirect URL",
"profile_oauth_redirect_url_help": "Your application's authorization callback URL.",
"profile_oauth_name_help": "Alguma coisa que seus usu\u00e1rios v\u00e3o reconhecer e identificar.",
"profile_oauth_redirect_url": "URL de redirecionamento",
"profile_oauth_redirect_url_help": "A URL de retorno da sua solicita\u00e7\u00e3o de autoriza\u00e7\u00e3o.",
"profile_authorized_apps": "Authorized applications",
"profile_authorized_clients": "Clientes autorizados",
"profile_scopes": "Escopos",
@@ -66,11 +66,13 @@
"profile_personal_access_tokens": "Tokens de acesso pessoal",
"profile_personal_access_token": "Token de acesso pessoal",
"profile_personal_access_token_explanation": "Here is your new personal access token. This is the only time it will be shown so don't lose it! You may now use this token to make API requests.",
"profile_no_personal_access_token": "You have not created any personal access tokens.",
"profile_no_personal_access_token": "Voc\u00ea n\u00e3o criou nenhum token de acesso pessoal.",
"profile_create_new_token": "Criar novo token",
"profile_create_token": "Criar token",
"profile_create": "Criar",
"profile_save_changes": "Salvar altera\u00e7\u00f5es"
"profile_save_changes": "Salvar altera\u00e7\u00f5es",
"default_group_title_name": "(n\u00e3o agrupado)",
"piggy_bank": "Cofrinho"
},
"form": {
"interest_date": "Data de interesse",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Creaz\u0103 un nou token",
"profile_create_token": "Creaz\u0103 token",
"profile_create": "Creaz\u0103",
"profile_save_changes": "Salveaz\u0103 modific\u0103rile"
"profile_save_changes": "Salveaz\u0103 modific\u0103rile",
"default_group_title_name": "(ungrouped)",
"piggy_bank": "Pu\u0219culi\u021b\u0103"
},
"form": {
"interest_date": "Data de interes",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Create new token",
"profile_create_token": "Create token",
"profile_create": "Create",
"profile_save_changes": "Save changes"
"profile_save_changes": "Save changes",
"default_group_title_name": "(\u0431\u0435\u0437 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0438)",
"piggy_bank": "\u041a\u043e\u043f\u0438\u043b\u043a\u0430"
},
"form": {
"interest_date": "\u0414\u0430\u0442\u0430 \u0432\u044b\u043f\u043b\u0430\u0442\u044b",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Create new token",
"profile_create_token": "Create token",
"profile_create": "Create",
"profile_save_changes": "Save changes"
"profile_save_changes": "Save changes",
"default_group_title_name": "(ungrouped)",
"piggy_bank": "Piggy bank"
},
"form": {
"interest_date": "R\u00e4ntedatum",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Create new token",
"profile_create_token": "Create token",
"profile_create": "Create",
"profile_save_changes": "Save changes"
"profile_save_changes": "Save changes",
"default_group_title_name": "(ungrouped)",
"piggy_bank": "Kumbara"
},
"form": {
"interest_date": "Faiz tarihi",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "T\u1ea1o m\u00e3 m\u1edbi",
"profile_create_token": "T\u1ea1o m\u00e3",
"profile_create": "T\u1ea1o",
"profile_save_changes": "L\u01b0u thay \u0111\u1ed5i"
"profile_save_changes": "L\u01b0u thay \u0111\u1ed5i",
"default_group_title_name": "(ch\u01b0a nh\u00f3m)",
"piggy_bank": "Heo \u0111\u1ea5t"
},
"form": {
"interest_date": "Ng\u00e0y l\u00e3i",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Create new token",
"profile_create_token": "Create token",
"profile_create": "Create",
"profile_save_changes": "Save changes"
"profile_save_changes": "Save changes",
"default_group_title_name": "(ungrouped)",
"piggy_bank": "\u5b58\u94b1\u7f50"
},
"form": {
"interest_date": "\u5229\u7387\u65e5\u671f",

View File

@@ -70,7 +70,9 @@
"profile_create_new_token": "Create new token",
"profile_create_token": "Create token",
"profile_create": "Create",
"profile_save_changes": "Save changes"
"profile_save_changes": "Save changes",
"default_group_title_name": "(ungrouped)",
"piggy_bank": "\u5c0f\u8c6c\u64b2\u6eff"
},
"form": {
"interest_date": "\u5229\u7387\u65e5\u671f",

View File

@@ -1483,12 +1483,12 @@ browserify-zlib@^0.2.0:
pako "~1.0.5"
browserslist@^4.0.0, browserslist@^4.12.0, browserslist@^4.8.5:
version "4.12.1"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.12.1.tgz#6d08bef149b70d153930780ba762644e0f329122"
integrity sha512-WMjXwFtPskSW1pQUDJRxvRKRkeCr7usN0O/Za76N+F4oadaTdQHotSGcX9jT/Hs7mSKPkyMFNvqawB/1HzYDKQ==
version "4.12.2"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.12.2.tgz#76653d7e4c57caa8a1a28513e2f4e197dc11a711"
integrity sha512-MfZaeYqR8StRZdstAK9hCKDd2StvePCYp5rHzQCPicUjfFliDgmuaBNPHYUTpAywBN8+Wc/d7NYVFkO0aqaBUw==
dependencies:
caniuse-lite "^1.0.30001088"
electron-to-chromium "^1.3.481"
electron-to-chromium "^1.3.483"
escalade "^3.0.1"
node-releases "^1.1.58"
@@ -1639,9 +1639,9 @@ caniuse-api@^3.0.0:
lodash.uniq "^4.5.0"
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001087, caniuse-lite@^1.0.30001088:
version "1.0.30001088"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001088.tgz#23a6b9e192106107458528858f2c0e0dba0d9073"
integrity sha512-6eYUrlShRYveyqKG58HcyOfPgh3zb2xqs7NvT2VVtP3hEUeeWvc3lqhpeMTxYWBBeeaT9A4bKsrtjATm66BTHg==
version "1.0.30001089"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001089.tgz#0634653159f1179093a35fd7f36dbd7c4ed85101"
integrity sha512-RnL5dbdqAfQ5oxHjFUU8uiyJMvTKoXfRn0Asp2R5cpRsyiY5+kLl0fcocQijb0V9XAWFEG/2A/vSswRmpYarmA==
chalk@^1.1.3:
version "1.1.3"
@@ -2455,7 +2455,7 @@ ee-first@1.1.1:
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
electron-to-chromium@^1.3.481:
electron-to-chromium@^1.3.483:
version "1.3.483"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.483.tgz#9269e7cfc1c8e72709824da171cbe47ca5e3ca9e"
integrity sha512-+05RF8S9rk8S0G8eBCqBRBaRq7+UN3lDs2DAvnG8SBSgQO3hjy0+qt4CmRk5eiuGbTcaicgXfPmBi31a+BD3lg==