Skip to content

Commit 53d988a

Browse files
fix #116
1 parent 58730c5 commit 53d988a

File tree

7 files changed

+111
-119
lines changed

7 files changed

+111
-119
lines changed

webBudget/src/main/java/br/com/webbudget/application/controller/entries/WalletBean.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,6 @@ public void showBalance(long walletId) {
263263

264264
this.openDialog("balanceHistoryDialog", "dialogBalanceHistory");
265265
}
266-
267-
/**
268-
* Atualiza os dados do saldo na tela
269-
*/
270-
public void updateBalanceDetails() {
271-
this.update("detailsPanel");
272-
}
273266

274267
/**
275268
* Carrega os dados referentes a conta bancaria quando o tipo a ser cadast-

webBudget/src/main/java/br/com/webbudget/domain/entity/wallet/WalletBalance.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import br.com.webbudget.domain.entity.PersistentEntity;
2020
import java.math.BigDecimal;
21+
import java.text.SimpleDateFormat;
2122
import javax.persistence.Column;
2223
import javax.persistence.Entity;
2324
import javax.persistence.JoinColumn;
@@ -80,4 +81,11 @@ public class WalletBalance extends PersistentEntity {
8081
@NotNull(message = "{wallet-balance.null-source}")
8182
@JoinColumn(name = "id_source_wallet")
8283
private Wallet sourceWallet;
84+
85+
/**
86+
* @return
87+
*/
88+
public String getInclusionFormatted() {
89+
return new SimpleDateFormat("dd/MM/yyyy HH:mm").format(this.getInclusion());
90+
}
8391
}

webBudget/src/main/java/br/com/webbudget/domain/entity/wallet/WalletBalanceType.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,22 @@
2525
*/
2626
public enum WalletBalanceType {
2727

28-
PAYMENT("beans.wallet-balance.payment"),
29-
REVENUE("beans.wallet-balance.revenue"),
30-
ADJUSTMENT("beans.wallet-balance.adjustment"),
31-
TRANSFERENCE("beans.wallet-balance.transference"),
32-
BALANCE_RETURN("beans.wallet-balance.balance-return"),
33-
TRANSFER_ADJUSTMENT("beans.wallet-balance.transfer-adjustment");
28+
PAYMENT("e1410a","beans.wallet-balance.payment"),
29+
REVENUE("66cdaa","beans.wallet-balance.revenue"), // 2aa668
30+
ADJUSTMENT("d8ae60","beans.wallet-balance.adjustment"),
31+
TRANSFERENCE("59484f","beans.wallet-balance.transference"),
32+
BALANCE_RETURN("66cccc","beans.wallet-balance.balance-return"),
33+
TRANSFER_ADJUSTMENT("ffa535","beans.wallet-balance.transfer-adjustment");
3434

35+
private final String color;
3536
private final String i18nKey;
3637

3738
/**
3839
*
3940
* @param i18nKey
4041
*/
41-
private WalletBalanceType(String i18nKey) {
42+
private WalletBalanceType(String color, String i18nKey) {
43+
this.color = color;
4244
this.i18nKey = i18nKey;
4345
}
4446

@@ -50,4 +52,11 @@ private WalletBalanceType(String i18nKey) {
5052
public String toString() {
5153
return this.i18nKey;
5254
}
55+
56+
/**
57+
* @return a cor para este balanco
58+
*/
59+
public String getStyleForType() {
60+
return "border-left: 10px solid #" + this.color;
61+
}
5362
}

webBudget/src/main/resources/i18n/messages_en_US.properties

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -358,13 +358,11 @@ adjustment.form.adjustment-value=Adjustment Value
358358
wallet.dialog.adjustment-confirm=Wallet balance for <span class='dialog-highlighted-text'>{0}</span> successfully adjusted!
359359
wallet.dialog.adjustment=Balance Adjustment
360360
balance-history.dialog=Balance History
361-
balance-history.dialog.wallet-identification=Showing balances for wallet: <span class='dialog-highlighted-text'>{0}</span>
361+
balance-history.dialog.wallet-identification={0}, actual balance: {1}
362362
balance-history.list.empty=No balances found for this wallet
363363
balance-history.list.type=Type
364-
balance-history.old-balance=Last Balance
365364
balance-history.actual-balance=Actual Balance
366365
balance-history.list.movemented-value=Valor
367-
balance-history.inclusion=Inclusion
368366
dashboard.graphs.no-data-revenue=No data to compose the revenues graph
369367
dashboard.graphs.no-data-expenses=No data to compose the expenses chart
370368
wallet.validate.has-balance=Only wallets with balance equals to zero can be deleted
@@ -504,8 +502,6 @@ financial-period.validate.invalid-end=End date less than or equal to the current
504502
adjustment.form.reason=Adjustment Reason
505503
transfer.form.reason=Transference Reason
506504
wallet.action.no-balances=This wallet has no balances yet
507-
balance-history.type=Type
508-
balance-history.reason=Reason
509505
transfer.dialog.header=Transference Rason
510506
card-invoice.list.checked=Yes
511507
card-invoice.list.unchecked=No
@@ -583,4 +579,7 @@ fixed-movement.list.is-autolaunch=Automatic
583579
fixed-movement.list.not-launched=Not launched on actual period
584580
fixed-movement.list.launched=Launched?
585581
fixed-movement.list.is-launched=Launched on active period
586-
balance-history.movemented-value=Movemented
582+
balance-history.in={0} in {1}
583+
balance-history.movemented-value=Value
584+
balance-history.old-balance=Old Balance
585+
balance-history.reason=Reason

webBudget/src/main/resources/i18n/messages_pt_BR.properties

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -358,13 +358,11 @@ adjustment.form.adjustment-value=Valor do Ajuste
358358
wallet.dialog.adjustment-confirm=Saldo da carteira <span class='dialog-highlighted-text'>{0}</span> ajustado com sucesso!
359359
wallet.dialog.adjustment=Ajuste de Saldo
360360
balance-history.dialog=Hist\u00f3rico de Saldos
361-
balance-history.dialog.wallet-identification=Mostrando hist\u00f3rico de saldos da carteira: <span class='dialog-highlighted-text'>{0}</span>
361+
balance-history.dialog.wallet-identification={0}, saldo atual: {1}
362362
balance-history.list.empty=Esta carteira n\u00e3o possui saldos
363363
balance-history.list.type=Tipo
364-
balance-history.old-balance=Saldo Anterior
365364
balance-history.actual-balance=Saldo Atual
366365
balance-history.list.movemented-value=Valor
367-
balance-history.inclusion=Inclus\u00e3o
368366
dashboard.graphs.no-data-revenue=Nenhum dado para compor o gr\u00e1fico de receitas
369367
dashboard.graphs.no-data-expenses=Nenhum dado para compor o gr\u00e1fico de despesas
370368
wallet.validate.has-balance=Somente carteiras com saldo igual a zero podem ser deletadas
@@ -504,8 +502,6 @@ financial-period.validate.invalid-end=Data final menor ou igual a data atual
504502
adjustment.form.reason=Motivo do Ajuste
505503
transfer.form.reason=Motivo da Transfer\u00eancia
506504
wallet.action.no-balances=Esta carteira ainda n\u00e3o possui saldos
507-
balance-history.type=Tipo
508-
balance-history.reason=Motivo
509505
transfer.dialog.header=Motivo Transfer\u00eancia
510506
card-invoice.list.checked=Sim
511507
card-invoice.list.unchecked=N\u00e3o
@@ -583,4 +579,7 @@ fixed-movement.list.is-autolaunch=Autom\u00e1tico
583579
fixed-movement.list.not-launched=N\u00e3o lan\u00e7ado no per\u00edodo atual
584580
fixed-movement.list.launched=Lan\u00e7ado?
585581
fixed-movement.list.is-launched=Lan\u00e7ado no per\u00edodo atual
586-
balance-history.movemented-value=Movimentado
582+
balance-history.in={0} em {1}
583+
balance-history.movemented-value=Valor
584+
balance-history.old-balance=Saldo Anterior
585+
balance-history.reason=Motivo

webBudget/src/main/webapp/main/entries/wallets/dialogBalanceHistory.xhtml

Lines changed: 60 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -31,97 +31,71 @@
3131

3232
<div class="ui-grid-row div-mg-b-15">
3333
<div class="ui-grid-col-12">
34-
<h:form prependId="false">
35-
<p:dataScroller id="balanceList"
36-
var="balance"
37-
mode="inline"
38-
chunkSize="10"
39-
scrollHeight="250"
40-
value="#{walletBean.walletBalances}">
41-
<f:facet name="header">
42-
<o:outputFormat escape="false"
43-
value="#{messages['balance-history.dialog.wallet-identification']} ">
44-
<f:param value="#{walletBean.wallet.friendlyName}" />
45-
</o:outputFormat>
46-
</f:facet>
34+
<p:dataScroller id="balanceList"
35+
var="balance"
36+
mode="inline"
37+
chunkSize="10"
38+
scrollHeight="250"
39+
value="#{walletBean.walletBalances}">
40+
<f:facet name="header">
41+
<o:outputFormat escape="false"
42+
value="#{messages['balance-history.dialog.wallet-identification']} ">
43+
<f:param value="#{walletBean.wallet.friendlyName}" />
44+
<f:param value="R$ #{walletBean.wallet.balance}" />
45+
</o:outputFormat>
46+
</f:facet>
4747

48-
<f:facet name="loader">
49-
<p:commandButton type="button"
50-
icon="fa fa-plus"
51-
value="#{menu['more']}" />
52-
</f:facet>
48+
<f:facet name="loader">
49+
<p:commandButton type="button"
50+
icon="fa fa-plus"
51+
value="#{menu['more']}" />
52+
</f:facet>
5353

54-
<div class="ui-grid-row div-pd-tb-10 balance-detail-box">
55-
<div class="ui-grid-col-2">
56-
<h:outputText styleClass="fa fa-plus"
57-
title="#{messages[balance.walletBalanceType]}"
58-
rendered="#{balance.walletBalanceType eq 'REVENUE'}"/>
59-
<h:outputText styleClass="fa fa-minus"
60-
title="#{messages[balance.walletBalanceType]}"
61-
rendered="#{balance.walletBalanceType eq 'PAYMENT'}"/>
62-
<h:outputText styleClass="fa fa-wrench"
63-
title="#{messages[balance.walletBalanceType]}"
64-
rendered="#{balance.walletBalanceType eq 'ADJUSTMENT'}"/>
65-
<h:outputText styleClass="fa fa-mail-reply"
66-
title="#{messages[balance.walletBalanceType]}"
67-
rendered="#{balance.walletBalanceType eq 'TRANSFERENCE'}"/>
68-
<h:outputText styleClass="fa fa-repeat"
69-
title="#{messages[balance.walletBalanceType]}"
70-
rendered="#{balance.walletBalanceType eq 'BALANCE_RETURN'}"/>
71-
<h:outputText styleClass="fa fa-mail-reply-all"
72-
title="#{messages[balance.walletBalanceType]}"
73-
rendered="#{balance.walletBalanceType eq 'TRANSFER_ADJUSTMENT'}"/>
54+
<div class="balance-detail-box"
55+
style="#{balance.walletBalanceType.styleForType}">
56+
<div class="ui-grid-row div-mg-b-10">
57+
<div class="ui-grid-col-12">
58+
<o:outputFormat escape="false"
59+
value="#{messages['balance-history.in']}">
60+
<f:param value="#{messages[balance.walletBalanceType]}" />
61+
<f:param value="#{balance.inclusionFormatted}" />
62+
</o:outputFormat>
7463
</div>
75-
<div class="ui-grid-col-10">
76-
<div class="ui-grid-row">
77-
<div class="ui-grid-col-4">
78-
<p:outputLabel value="#{messages['balance-history.movemented-value']}"/>
79-
<h:outputText value="#{balance.movementedValue}">
80-
<f:convertNumber pattern="¤#,##0.00" currencySymbol="R$ " />
81-
</h:outputText>
82-
</div>
83-
<div class="ui-grid-col-4">
84-
<p:outputLabel value="#{messages['balance-history.old-balance']}"/>
85-
<h:outputText styleClass="balance-value"
86-
value="#{walletBean.selectedBalance.oldBalance}"
87-
style="#{walletBean.selectedBalance.oldBalance.signum() lt 0 ? 'color: red;' :
88-
walletBean.selectedBalance.oldBalance.signum() gt 0 ? 'color: green': ''}">
89-
<f:convertNumber pattern="¤#,##0.00" currencySymbol="R$ " />
90-
</h:outputText>
91-
</div>
92-
<div class="ui-grid-col-4">
93-
<p:outputLabel value="#{messages['balance-history.actual-balance']}"/>
94-
<h:outputText value="#{walletBean.selectedBalance.actualBalance}"
95-
style="#{walletBean.selectedBalance.actualBalance.signum() lt 0 ? 'color: red;' :
96-
walletBean.selectedBalance.actualBalance.signum() gt 0 ? 'color: green': ''}">
97-
<f:convertNumber pattern="¤#,##0.00" currencySymbol="R$ " />
98-
</h:outputText>
99-
</div>
100-
</div>
101-
<div class="ui-grid-row">
102-
<div class="ui-grid-col-6">
103-
<p:outputLabel value="#{messages['balance-history.type']}:"/>
104-
#{messages[walletBean.selectedBalance.walletBalanceType]}
105-
</div>
106-
<div class="ui-grid-col-6">
107-
<p:outputLabel value="#{messages['balance-history.inclusion']}:"/>
108-
<h:outputText value="#{walletBean.selectedBalance.inclusion}">
109-
<f:convertDateTime pattern="dd/MM/yyyy HH:mm" />
110-
</h:outputText>
111-
</div>
112-
</div>
113-
<div class="ui-grid-row"
114-
jsf:rendered="#{walletBean.selectedBalance.reason ne null}">
115-
<div class="ui-grid-col-12">
116-
<h:outputText styleClass="balance-detail-label"
117-
value="#{messages['balance-history.reason']}:"/>
118-
<h:outputText value="#{walletBean.selectedBalance.reason}" />
119-
</div>
120-
</div>
64+
</div>
65+
<div class="ui-grid-row">
66+
<div class="ui-grid-col-4">
67+
<p:outputLabel value="#{messages['balance-history.movemented-value']}"/>
68+
<h:outputText value="#{balance.movementedValue}">
69+
<f:convertNumber pattern="¤#,##0.00" currencySymbol="R$ " />
70+
</h:outputText>
71+
</div>
72+
<div class="ui-grid-col-4">
73+
<p:outputLabel value="#{messages['balance-history.old-balance']}"/>
74+
<h:outputText styleClass="balance-value"
75+
value="#{balance.oldBalance}"
76+
style="#{balance.oldBalance.signum() lt 0 ? 'color: red;' :
77+
balance.oldBalance.signum() gt 0 ? 'color: green': ''}">
78+
<f:convertNumber pattern="¤#,##0.00" currencySymbol="R$ " />
79+
</h:outputText>
80+
</div>
81+
<div class="ui-grid-col-4">
82+
<p:outputLabel value="#{messages['balance-history.actual-balance']}"/>
83+
<h:outputText value="#{balance.actualBalance}"
84+
style="#{balance.actualBalance.signum() lt 0 ? 'color: red;' :
85+
balance.actualBalance.signum() gt 0 ? 'color: green': ''}">
86+
<f:convertNumber pattern="¤#,##0.00" currencySymbol="R$ " />
87+
</h:outputText>
88+
</div>
89+
</div>
90+
<div class="ui-grid-row div-mg-t-10"
91+
jsf:rendered="#{balance.reason ne null}">
92+
<div class="ui-grid-col-12">
93+
<p:outputLabel value="#{messages['balance-history.reason']}"/>
94+
#{balance.reason}
12195
</div>
12296
</div>
123-
</p:dataScroller>
124-
</h:form>
97+
</div>
98+
</p:dataScroller>
12599
</div>
126100
</div>
127101
<div class="ui-grid-row">

webBudget/src/main/webapp/resources/css/style.css

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ td {
162162
.div-pd-lr-10 {
163163
padding: 0 10px;
164164
}
165+
.div-pd-b-10 {
166+
padding-bottom: 10px;
167+
}
165168
.div-mg-b-15 {
166169
margin-bottom: 15px;
167170
}
@@ -174,6 +177,9 @@ td {
174177
.div-mg-t-10 {
175178
margin-top: 10px;
176179
}
180+
.div-mg-b-10 {
181+
margin-bottom: 10px;
182+
}
177183
.div-mg-t-25 {
178184
margin-top: 25px;
179185
}
@@ -572,20 +578,24 @@ td {
572578
height: 34px;
573579
}
574580

575-
/* formulario de ajust de saldo -------------- */
581+
/* formulario de ajuste de saldo -------------- */
576582
.adjustment-reason-input {
577583
width: 95%;
578584
}
579585

580-
/* formulario de ajuste de saldo -------------- */
581-
.balance-detail-box label {
582-
display: block;
583-
font-weight: 700 !important;
584-
}
585-
586586
/* form de movimentos fixos ------------------ */
587587
#inUndetermined {
588588
position: relative;
589589
top: 7px;
590590
margin-left: 15px;
591+
}
592+
593+
/* consulta de saldos da carteira ------------ */
594+
.balance-detail-box {
595+
padding: 5px 0 0 5px;
596+
margin-bottom: 10px;
597+
}
598+
.balance-detail-box label {
599+
display: block;
600+
font-weight: 700 !important;
591601
}

0 commit comments

Comments
 (0)