Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added dist/images/cash-flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/images/payables.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions dist/images/plot-line-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/images/projected-cash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/images/receivables.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module = angular.module('impac.components.widgets.accounts-cash-balance', [])
module.controller('WidgetAccountsCashBalanceCtrl', ($scope, $q, $timeout, $filter, ImpacTheming, HighchartsFactory) ->
module.controller('WidgetAccountsCashBalanceCtrl', ($scope, $q, $timeout, $filter, ImpacTheming, ImpacAssets, HighchartsFactory) ->

w = $scope.widget

Expand All @@ -21,10 +21,8 @@ module.controller('WidgetAccountsCashBalanceCtrl', ($scope, $q, $timeout, $filte

# Custom chart legend
$scope.groupedTable = w.content.grouped_table

# TODO: theming config for positive/negative hex codes (or move to API)
# chartColors = ImpacTheming.get().chartColors

# Set chart accounts series colors by account bias ('positive' / 'negative')
setSeriesColors(w.content.chart.series, { positive: '#3FC4FF', negative: '#e50228'})

Expand All @@ -34,11 +32,15 @@ module.controller('WidgetAccountsCashBalanceCtrl', ($scope, $q, $timeout, $filte
visibility = if serie.visible then false else true
serie.setVisible(visibility)

$scope.getLegendItemIcon = (account)->
$scope.getLegendItemCheckBox = (account)->
serie = $scope.chart? && $scope.chart.hc? && getSerieByAccount($scope.chart.hc.series, account)
return 'fa-check-square-o' unless serie
if serie.visible then 'fa-check-square-o' else 'fa-square-o'

$scope.getLegendItemIcon = (account)->
serie = $scope.chart? && $scope.chart.hc? && getSerieByAccount($scope.chart.hc.series, account)
if serie.type == 'area' then ImpacAssets.get('areaLegendIcon') else ImpacAssets.get('plotLineLegendIcon')

$scope.getLegendItemColor = (account)->
serie = $scope.chart? && $scope.chart.hc? && getSerieByAccount($scope.chart.hc.series, account)
return '#000' unless serie
Expand Down Expand Up @@ -74,7 +76,6 @@ module.controller('WidgetAccountsCashBalanceCtrl', ($scope, $q, $timeout, $filte
$scope.chart ||= new HighchartsFactory($scope.chartId(), w.content.chart, options)
$scope.chart.render(w.content.chart, options)


# Widget is ready: can trigger the "wait for settings to be ready"
# --------------------------------------
$scope.widgetDeferred.resolve(settingsPromises)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
}
}

.legend-item-icon {
width: 16px;
height: 16px;
}

.right-panel {
display: flex;
flex-direction: column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ <h4>Widget settings</h4>
<div class="header" ng-repeat="header in groupedTable.headers">
<h4 ng-bind="header | titleize"></h4>
<div class="group-item" ng-repeat="item in groupedTable.groups[$index]" ng-click="legendItemOnClick(item)">
<i ng-style="{'color': getLegendItemColor(item)}" class="fa {{getLegendItemIcon(item)}}" aria-hidden="true"></i>
<i ng-style="{'color': getLegendItemColor(item)}" class="fa" ng-class="getLegendItemCheckBox(item)" aria-hidden="true"></i>
<div>
<svg ng-include="getLegendItemIcon(item)" class="legend-item-icon" ng-style="{'fill': getLegendItemColor(item)}"></svg>
</div>&nbsp;
<span ng-bind="item.name"></span>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module = angular.module('impac.components.widgets.accounts-cash-projection', [])
module.controller('WidgetAccountsCashProjectionCtrl', ($scope, $q, $filter, ImpacKpisSvc, HighchartsFactory) ->
module.controller('WidgetAccountsCashProjectionCtrl', ($scope, $q, $filter, ImpacKpisSvc, ImpacAssets, HighchartsFactory) ->

w = $scope.widget

Expand Down Expand Up @@ -64,8 +64,20 @@ module.controller('WidgetAccountsCashProjectionCtrl', ($scope, $q, $filter, Impa
thresholds: getThresholds()

$scope.chart ||= new HighchartsFactory($scope.chartId(), w.content.chart, options)
$scope.chart.render(w.content.chart, options)
# Extend default chart formatters to add custom legend img icon
defaultFormattersConfig = $scope.chart.formatters()
$scope.chart.formatters = ->
angular.merge(defaultFormattersConfig, {
legend:
useHTML: true
labelFormatter: ->
name = this.name
imgSrc = ImpacAssets.get(_.camelCase(name + 'LegendIcon'))
img = "<img src='#{imgSrc}'><br>"
return img + ' ' + name
})

$scope.chart.render(w.content.chart, options)
$scope.chartDeferred.notify($scope.chart.hc)

$scope.chartId = ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
.analytics .widget-item .content.accounts-cash-projection {
.tall-widget();

.cash-projection-chart {
height: ~"calc(@{impac-big-widget-size} - 50px)";
.cash-projection-chart {
height: ~"calc(@{impac-big-widget-size} - 50px)";
}

.highcharts-legend-item {

rect.highcharts-point {
display: none;
}

span {
width: 110px;
text-align: center;
img {
text-align: center;
width: 55px;
height: 25px;
}
}
}

.offset-box {
Expand Down
18 changes: 18 additions & 0 deletions src/images/area-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/cash-flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/payables.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions src/images/plot-line-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/projected-cash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/receivables.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/services/assets/assets.svc.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ angular
impacTitleLogo: ':default/impac-title-logo.png'
impacDashboardBackground: ':default/impac-dashboard-background.png'
currencyConversionsIcon: ':default/currency-conversions.png'
cashFlowLegendIcon: ':default/cash-flow.png'
payablesLegendIcon: ':default/payables.png'
projectedCashLegendIcon: ':default/projected-cash.png'
receivablesLegendIcon: ':default/receivables.png'
plotLineLegendIcon: ':default/plot-line-icon.svg'
areaLegendIcon: ':default/area-icon.svg'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason the cash-projection widget icons cannot be svg agian?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cesar-tonnoir I think we were going to wait for Tristan's review. I can make them svg today so that the decision can be made. There is also the question of whether to use a custom legend for the cash-projection widget like the cash-balance widget.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True @rheasunshine, ok no worries sounds good.


#=======================================
# Public methods available in config
Expand Down