-
Notifications
You must be signed in to change notification settings - Fork 19
Make Student vitals field auditable for tracking datestamps #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 8 commits
0e3e1bb
579b143
7d512b0
1301a5d
7daa957
9cab591
de18329
48a6836
4d2e791
64ee136
9e36986
2103e3d
d293787
f6e98ff
6cc0367
d171d19
f02a633
37d3297
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <?php | ||
|
|
||
| $app_strings['LBL_STUDENT_VITAL_CHART_DESC'] = 'Pie Chart grouping combined days in vitals status'; | ||
| $app_strings['LBL_STUDENT_VITAL_CHART'] = 'Student Vitals Chart'; | ||
| $app_strings['LBL_VITALS_DASHLET_SELECT_TEAM'] = 'Select Super Group to view data on'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <div class="student-bital-chart"> | ||
| <div class="sc-chart" data-content="chart"> | ||
| <svg id="{{cid}}"></svg> | ||
| </div> | ||
| <div class="block-footer hide" data-content="nodata">{{str "LBL_NO_DATA_AVAILABLE"}}</div> | ||
| </div> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| /* | ||
| * Your installation or use of this SugarCRM file is subject to the applicable | ||
| * terms available at | ||
| * http://support.sugarcrm.com/Resources/Master_Subscription_Agreements/. | ||
| * If you do not agree to all of the applicable terms or do not have the | ||
| * authority to bind the entity as an authorized representative, then do not | ||
| * install or use this SugarCRM file. | ||
| * | ||
| * Copyright (C) SugarCRM Inc. All rights reserved. | ||
| */ | ||
| ({ | ||
| plugins: ['Dashlet', 'Chart'], | ||
| className: 'student-vital-chart', | ||
| chartCollection: null, | ||
| hasData: false, | ||
| total: 0, | ||
|
|
||
| /** | ||
| * @inheritdoc | ||
| */ | ||
| initialize: function(options) { | ||
| this._super('initialize', [options]); | ||
|
|
||
| this.listenTo(this, 'render', function () { | ||
| this.retrieveSuperGroupOptions(); | ||
| } ); | ||
| this.chart = sucrose.charts.pieChart() | ||
| .donut(true) | ||
| .donutLabelsOutside(true) | ||
| .donutRatio(0.25) | ||
| .hole(false) | ||
| .showTitle(true) | ||
| .tooltips(true) | ||
| .showLegend(true) | ||
| .colorData('class') | ||
| .tooltipContent(_.bind(function(eo, properties) { | ||
|
|
||
| var value = parseInt(this.chart.getValue()(eo), 10); | ||
| var total = parseInt(properties.total, 10); | ||
| (total == 0) ? total = 1 : ''; | ||
| var percentage = value/total * 100; | ||
| return '<h3>' + this.chart.fmtKey()(eo) + '</h3>' + | ||
| '<p>' + value + ' days</p>' + | ||
| '<p>' + percentage.toFixed(2) + '%</p>'; | ||
| }, this)) | ||
| .strings({ | ||
| noData: app.lang.get('LBL_CHART_NO_DATA') | ||
| }); | ||
| }, | ||
|
|
||
|
|
||
| /** | ||
| * Generic method to render chart with check for visibility and data. | ||
| * Called by _renderHtml and loadData. | ||
| */ | ||
| renderChart: function() { | ||
| var self = this; | ||
| if (!self.isChartReady()) { | ||
|
|
||
| return; | ||
| } | ||
|
|
||
|
|
||
| d3sugar.select(this.el).select('svg#' + this.cid) | ||
| .datum(self.chartCollection) | ||
| .call(self.chart); | ||
|
|
||
| this.chart_loaded = _.isFunction(this.chart.update); | ||
| this.displayNoData(!this.chart_loaded); | ||
|
|
||
| }, | ||
|
|
||
| /** | ||
| * @inheritdoc | ||
| */ | ||
| loadData: function(options) { | ||
|
|
||
| if(this.meta.config) { | ||
|
|
||
| return; | ||
| } | ||
| var self = this; | ||
| var team_value = this.meta.vitals_dashlet_team ? this.meta.vitals_dashlet_team : 'all'; | ||
| url = app.api.buildURL('contacts/professorM/getStudentVitalData/' + team_value); | ||
| this.hasData = false; | ||
| app.api.call('GET', url, null, { | ||
| success: function(data) { | ||
| self.hasData = true; | ||
| self.evaluateResponse(data); | ||
| self.render(); | ||
| }, | ||
| complete: options ? options.complete : null | ||
| }); | ||
|
|
||
| }, | ||
|
|
||
| evaluateResponse: function(data) { | ||
|
|
||
| this.total = 1; | ||
| this.hasData = true; | ||
| this.chartCollection = $.parseJSON(data); | ||
|
|
||
| }, | ||
|
|
||
| retrieveSuperGroupOptions: function() { | ||
| if (!this.meta.config) { | ||
| return; | ||
| } | ||
| console.log(this.meta.vitals_dashlet_team); | ||
ShadMickelberry marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| var team_value = this.meta.vitals_dashlet_team ? this.meta.vitals_dashlet_team : 'all'; | ||
| var accounts = app.data.createBeanCollection('Accounts'); | ||
| var teams = []; | ||
| teams.push({id: 'all', text:'All'}) | ||
| accounts.fetch({ | ||
| success: function() { | ||
| accounts.comparator = 'name'; | ||
| accounts.sort({silent: true}); | ||
| _.each(accounts.models, function(account){ | ||
| teams.push({id: account.id, text: account.attributes.name}); | ||
| }); | ||
|
|
||
| $('[name="vitals_dashlet_team"]').html('').select2({data: teams}); | ||
| $('[name="vitals_dashlet_team"]').val(team_value).trigger('change'); | ||
| } | ||
| }) | ||
| }, | ||
| }) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| <?php | ||
|
|
||
| $viewdefs['base']['view']['student-vital-chart'] = array( | ||
| 'dashlets' => array( | ||
| array( | ||
| 'label' => 'LBL_STUDENT_VITAL_CHART', | ||
| 'description' => 'LBL_STUDENT_VITAL_CHART_DESC', | ||
| 'config' => array( | ||
| 'date_range' => 'all', | ||
| 'team' => 'all', | ||
| ), | ||
| 'preview' => array( | ||
| ), | ||
| 'filter' => array( | ||
| 'view' => array( | ||
| 'records', | ||
| 'record' | ||
| ) | ||
| ), | ||
|
|
||
| ), | ||
|
|
||
| ), | ||
| 'panels' => array( | ||
| array( | ||
| 'name' => 'panel_body', | ||
| 'columns' => 2, | ||
| 'labelsOnTop' => true, | ||
| 'placeholders' => true, | ||
| 'fields' => array( | ||
|
|
||
| array( | ||
| 'name' => 'vitals_dashlet_team', | ||
|
||
| 'label' => 'LBL_VITALS_DASHLET_SELECT_TEAM', | ||
| 'type' => 'enum', | ||
| 'options' => array('all' => 'All'), | ||
| ), | ||
| array( | ||
| 'name' => 'vitals_dashlet_date_range', | ||
| 'label' => 'LBL_VITALS_DASHLET_SELECT_DATE_RANGE', | ||
| 'type' => 'enum', | ||
| 'options' => array('all' => 'All Time', 'ThisYear' => 'This Year', 'LastYear' => 'Last Year'), | ||
| ), | ||
| ), | ||
| ), | ||
| ), | ||
| ); | ||
Uh oh!
There was an error while loading. Please reload this page.