Module: Achoo::UI::Commands
Instance Method Summary
collapse
Methods included from Common
#confirm
#date_chooser, #month_chooser, #optionally_ranged_date_chooser
Instance Method Details
#lock_month ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/achoo/ui/commands.rb', line 33
def lock_month
month = month_chooser
form = Achievo::LockMonthForm.new
form.lock_month(month)
form.print_values
if confirm
form.submit
else
puts "Cancelled"
end
end
|
#show_flexi_time ⇒ Object
25
26
27
28
29
30
|
# File 'lib/achoo/ui/commands.rb', line 25
def show_flexi_time
date = date_chooser
form = Achievo::HourAdministrationForm.new
balance = form.flexi_time(date)
puts "Flexi time balance: #{Term::underline(balance)}"
end
|
#show_holiday_report ⇒ Object
46
47
48
49
50
|
# File 'lib/achoo/ui/commands.rb', line 46
def show_holiday_report
page = AGENT.get(RC[:holiday_report_url])
page.body.match(/<b>(\d+,\d+)<\/b>/)
puts "Balance: #{Term::underline($1)}"
end
|
#show_registered_hours_for_day ⇒ Object
12
13
14
15
16
|
# File 'lib/achoo/ui/commands.rb', line 12
def show_registered_hours_for_day
date = date_chooser
form = Achievo::HourAdministrationForm.new
form.show_registered_hours_for_day(date)
end
|
#show_registered_hours_for_week ⇒ Object
18
19
20
21
22
|
# File 'lib/achoo/ui/commands.rb', line 18
def show_registered_hours_for_week
date = date_chooser
form = Achievo::HourAdministrationForm.new
form.show_registered_hours_for_week(date)
end
|
#view_report ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/achoo/ui/commands.rb', line 53
def view_report
choices = RC[:reports].keys
answer = Term.choose('Report', choices)
key = choices[answer.to_i - 1]
puts "Fetching data ..."
page = AGENT.get(RC[:url] + RC[:reports][key])
table = Achievo::Table.new(page.search('#rl_1 tr'))
table.select_columns do |c|
['Date', 'Project', 'Phase', 'Remark', 'Time'].include?(c[0])
end
Term::Table.new(table.first,
table[2...table.length-1],
table.last).print
end
|