2016-06-28 12:45:41 +02:00
|
|
|
module AvailabilityHelper
|
|
|
|
MACHINE_COLOR = '#e4cd78'
|
|
|
|
TRAINING_COLOR = '#bd7ae9'
|
|
|
|
EVENT_COLOR = '#dd7e6b'
|
|
|
|
IS_RESERVED_BY_CURRENT_USER = '#b2e774'
|
|
|
|
MACHINE_IS_RESERVED_BY_USER = '#1d98ec'
|
2016-06-29 17:37:22 +02:00
|
|
|
IS_COMPLETED = '#eeeeee'
|
2016-06-28 12:45:41 +02:00
|
|
|
|
|
|
|
def availability_border_color(availability)
|
|
|
|
if availability.available_type == 'machines'
|
|
|
|
MACHINE_COLOR
|
|
|
|
elsif availability.available_type == 'training'
|
|
|
|
TRAINING_COLOR
|
|
|
|
else
|
|
|
|
EVENT_COLOR
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def machines_slot_border_color(slot)
|
2016-06-29 17:37:22 +02:00
|
|
|
slot.is_reserved ? (slot.is_reserved_by_current_user ? IS_RESERVED_BY_CURRENT_USER : IS_COMPLETED) : MACHINE_COLOR
|
2016-06-28 12:45:41 +02:00
|
|
|
end
|
|
|
|
|
2016-06-29 17:37:22 +02:00
|
|
|
def trainings_events_border_color(availability)
|
2016-06-28 12:45:41 +02:00
|
|
|
if availability.is_reserved
|
|
|
|
IS_RESERVED_BY_CURRENT_USER
|
|
|
|
elsif availability.is_completed
|
2016-06-29 17:37:22 +02:00
|
|
|
IS_COMPLETED
|
2016-06-28 12:45:41 +02:00
|
|
|
else
|
2016-06-29 17:37:22 +02:00
|
|
|
if availability.available_type == 'training'
|
|
|
|
TRAINING_COLOR
|
|
|
|
else
|
|
|
|
EVENT_COLOR
|
|
|
|
end
|
2016-06-28 12:45:41 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|