Module: Achoo::UI::Commands

Includes:
Common, DateChoosers
Included in:
Achoo
Defined in:
lib/achoo/ui/commands.rb

Instance Method Summary collapse

Methods included from Common

#confirm

Methods included from DateChoosers

#date_chooser, #month_chooser, #optionally_ranged_date_chooser

Instance Method Details

#lock_month(agent) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/achoo/ui/commands.rb', line 31

def lock_month(agent)
  month = month_chooser
  form   = Achoo::LockMonthForm.new(agent)
  form.lock_month(month)
  form.print_values
  if confirm
    form.submit
  else
    puts "Cancelled"
  end
end

#show_flexi_time(agent) ⇒ Object



23
24
25
26
27
28
# File 'lib/achoo/ui/commands.rb', line 23

def show_flexi_time(agent)
  date = date_chooser
  form = Achoo::HourAdministrationForm.new(agent)
  balance = form.flexi_time(date)
  puts "Flexi time balance: #{Achoo::Term::underline(balance)}"
end

#show_holiday_report(agent) ⇒ Object



44
45
46
47
48
# File 'lib/achoo/ui/commands.rb', line 44

def show_holiday_report(agent)
  page = agent.get(RC[:holiday_report_url])
  page.body.match(/<b>(\d+,\d+)<\/b>/)
  puts "Balance: #{Achoo::Term::underline($1)}"
end

#show_registered_hours_for_day(agent) ⇒ Object



10
11
12
13
14
# File 'lib/achoo/ui/commands.rb', line 10

def show_registered_hours_for_day(agent)
  date = date_chooser
  form = Achoo::HourAdministrationForm.new(agent)
  form.show_registered_hours_for_day(date)
end

#show_registered_hours_for_week(agent) ⇒ Object



16
17
18
19
20
# File 'lib/achoo/ui/commands.rb', line 16

def show_registered_hours_for_week(agent)
  date = date_chooser
  form = Achoo::HourAdministrationForm.new(agent)
  form.show_registered_hours_for_week(date)
end