-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.rb
43 lines (40 loc) · 1.42 KB
/
main.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require_relative './models/service'
require_relative './models/serviceProvider'
require_relative './models/appointment'
require_relative './models/timeblock'
require_relative './lib/print'
require_relative './seeder/init'
require_relative './lib/colors'
require_relative './models/availability'
require_relative './controllers/sp_controller'
require_relative './controllers/s_controller'
require_relative './controllers/a_controller'
require_relative './controllers/avail_controller'
require 'tty-prompt'
$prompt = TTY::Prompt.new
commands = {
'Add service' => Proc.new{serviceAdd},
'Remove service' => Proc.new{serviceRemove},
'View services' => Proc.new{servicePrint($all_sp)},
'Add service provider' => Proc.new{spAdd},
'Remove service provider' => Proc.new{spRemove},
'View service providers' => Proc.new{spPrint($all_sp)},
'Add appointments' => Proc.new{appointmentAdd},
'Remove appointments' => Proc.new{appointmentRemove},
'Add availability' => Proc.new{availabilityAdd},
'Remove availability' => Proc.new{availabilityRemove},
'View availability' => Proc.new{scheduleView('avail')},
'View schedule' => Proc.new{scheduleView('appt')},
'Exit program' => 0
}
# INITIALIZE
$all_sp = initData
user_is_done = false
while !user_is_done
user_task = $prompt.select("What would you like to do?", commands.keys, cycle: true)
if user_task != 'Exit program'
commands[user_task].call()
else
user_is_done = true
end
end