Skip to content

Instantly share code, notes, and snippets.

@timlevett
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timlevett/61951dc9f51e38ba0dfd to your computer and use it in GitHub Desktop.
Save timlevett/61951dc9f51e38ba0dfd to your computer and use it in GitHub Desktop.
Time and Absence smart widget
{
"report":[
{
"entitlement":"Comp Time Balance",
"balance":10.5,
"job":{
"id":0,
"mailDrop":null,
"departmentName":"DOIT/ENTERPRISE/PCS",
"title":"IS TECH SRV SPECIALIST"
}
},
{
"entitlement":"ALRA Balance",
"balance":0,
"job":{
"id":0,
"mailDrop":null,
"departmentName":"DOIT/ENTERPRISE/PCS",
"title":"IS TECH SRV SPECIALIST"
}
},
{
"entitlement":"Legal Holiday Balance YTD",
"balance":40,
"job":{
"id":0,
"mailDrop":null,
"departmentName":"DOIT/ENTERPRISE/PCS",
"title":"IS TECH SRV SPECIALIST"
}
},
{
"entitlement":"Personal Holiday Balance",
"balance":0,
"job":{
"id":0,
"mailDrop":null,
"departmentName":"DOIT/ENTERPRISE/PCS",
"title":"IS TECH SRV SPECIALIST"
}
},
{
"entitlement":"Sabbatical Balance",
"balance":0,
"job":{
"id":0,
"mailDrop":null,
"departmentName":"DOIT/ENTERPRISE/PCS",
"title":"IS TECH SRV SPECIALIST"
}
},
{
"entitlement":"Sick Leave Balance (class)",
"balance":7894,
"job":{
"id":0,
"mailDrop":null,
"departmentName":"DOIT/ENTERPRISE/PCS",
"title":"IS TECH SRV SPECIALIST"
}
},
{
"entitlement":"Vacation Carryover Balance",
"balance":0,
"job":{
"id":0,
"mailDrop":null,
"departmentName":"DOIT/ENTERPRISE/PCS",
"title":"IS TECH SRV SPECIALIST"
}
},
{
"entitlement":"Vacation Allocation Balance",
"balance":110,
"job":{
"id":0,
"mailDrop":null,
"departmentName":"DOIT/ENTERPRISE/PCS",
"title":"IS TECH SRV SPECIALIST"
}
},
{
"entitlement":"Sick Leave Balance (uncls)",
"balance":0,
"job":{
"id":0,
"mailDrop":null,
"departmentName":"DOIT/ENTERPRISE/PCS",
"title":"IS TECH SRV SPECIALIST"
}
},
{
"entitlement":"Vacation Carryover Balance",
"balance":0,
"job":{
"id":0,
"mailDrop":null,
"departmentName":"DOIT/ENTERPRISE/PCS",
"title":"IS TECH SRV SPECIALIST"
}
},
{
"entitlement":"Classified Furlough Allocated",
"balance":0,
"job":{
"id":0,
"mailDrop":null,
"departmentName":"DOIT/ENTERPRISE/PCS",
"title":"IS TECH SRV SPECIALIST"
}
},
{
"entitlement":"Vacation Available",
"balance":110,
"job":{
"id":0,
"mailDrop":null,
"departmentName":"DOIT/ENTERPRISE/PCS",
"title":"IS TECH SRV SPECIALIST"
}
}
]
}

Initial Landing

initial landing

When User Clicks

view

Loading State

http://goo.gl/T7KThh

Error State

http://goo.gl/iUGra2

Hover over entry

http://goo.gl/no08Y2

After review

  • Remove splash block screen
  • Add in Show/Hide button on top for balances http://goo.gl/sX7tMv
<div ng-init='show=false'>
<div class='container-fluid ' ng-show='!isEmpty' >
<div class='row'>
<div class='col-xs-2'>&nbsp;</div>
<div class='col-xs-8 center'> <button ng-click='show=!show' class='btn btn-flat'><span ng-if='!show'>Show</span><span ng-if='show'>Hide</span> balances</button></div>
<div class='col-xs-2'>&nbsp;</div>
</div>
</div>
</div>
<div>
<loading-gif data-object='content' data-empty='isEmpty'></loading-gif>
<div ng-if='isEmpty' style='padding: 10px; font-size: 14px;'><i class='fa fa-exclamation-triangle fa-3x pull-left' style='color: #b70101;'></i><span style='color: #898989;'>We had a problem fetching your balances.</span></div>
</div>
<ul class='widget-list'>
<li ng-repeat=\"item in filteredArray(content.report,'entitlement',['Sick','Vacation Ava','Sabbatical', 'Personal']) | orderBy:'entitlement' | limitTo:5\">
<p class='bold'>{{item.entitlement}}<span class='right' ng-if='show'>{{item.balance}}</span><span class='right' style='font-style: italic; font-weight: 100;' ng-if='!show'>hidden</span> </p>
</li>
<li ng-if='content.report.length > 5' style='font-style: italic; text-align: center;'>Showing 5 out of {{ content.report.length}} </li>
</ul>
</div><a class='btn btn-default launch-app-button ng-scope' href='{{portlet.url}}'>See all balances</a>
@keirserrie
Copy link

This is really awesome. Would like to talk more about hiding the balance, although I'm sure this is required. Bummer. Also let's consider limiting the widget display to only a few balances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment