diff --git a/app/models/paid_time_off.rb b/app/models/paid_time_off.rb index 3648359..e4e4dd0 100644 --- a/app/models/paid_time_off.rb +++ b/app/models/paid_time_off.rb @@ -3,4 +3,12 @@ class PaidTimeOff < ActiveRecord::Base belongs_to :user has_one :schedule, :foreign_key => :user_id, :primary_key => :user_id + def sick_days_remaining + self.sick_days_earned - self.sick_days_taken + end + + def pto_days_reamining + self.pto_earned - self.pto_taken + end + end diff --git a/app/views/paid_time_off/index.html.erb b/app/views/paid_time_off/index.html.erb index cd7bc29..e937cff 100644 --- a/app/views/paid_time_off/index.html.erb +++ b/app/views/paid_time_off/index.html.erb @@ -38,7 +38,7 @@
- Column Chart + Sick Days
@@ -72,19 +72,14 @@ $('.date_picker').daterangepicker({ function drawChart3() { var data = google.visualization.arrayToDataTable([ - ['Year', 'Visitors', 'Orders', 'Income', 'Expenses'], - ['2007', 300, 800, 900, 300], - ['2008', 1170, 860, 1220, 564], - ['2009', 260, 1120, 2870, 2340], - ['2010', 1030, 540, 3430, 1200], - ['2011', 200, 700, 1700, 770], - ['2012', 1170, 2160, 3920, 800], ]); + ['Current Date', 'Days Earned', 'Days Taken', 'Days Remaining'], + [ <%= "As of today: #{Date.today}".inspect.html_safe %>, <%= @pto.sick_days_earned %>, <%= @pto.sick_days_taken %>, <%= @pto.sick_days_remaining %> ], ]); var options = { width: 'auto', height: '160', backgroundColor: 'transparent', - colors: ['#b5799e', '#579da9', '#e26666', '#1e825e', '#dba26b'], + colors: ['#579da9', '#e26666', '#1e825e'], tooltip: { textStyle: { color: '#666666',