Added tablet view Added time Implemented reserve now buttons Implemented auto-scale Implemented reservation edit and deletion
54 lines
1.3 KiB
GDScript
54 lines
1.3 KiB
GDScript
extends HBoxContainer
|
|
class_name Reservation
|
|
|
|
const Colors = {
|
|
1: Color("00b1a1d6"),
|
|
2: Color("f431e0d6"),
|
|
3: Color("eb7130d6")
|
|
}
|
|
|
|
@onready var _main: Main = get_tree().get_current_scene()
|
|
@onready var _title = $Section/SectionLabel
|
|
@onready var _panel = $Section/SectionPanel
|
|
|
|
var _hour_size : int
|
|
var _minutes : int
|
|
var _id : String
|
|
|
|
func _ready():
|
|
initialize_signals()
|
|
|
|
func _process(delta):
|
|
_process_hour_size()
|
|
|
|
func _process_hour_size():
|
|
_hour_size = get_viewport_rect().size.y/15
|
|
_panel.size.y = _minutes * _hour_size / 60
|
|
custom_minimum_size.y = _panel.size.y
|
|
|
|
func initialize_signals():
|
|
_panel.gui_input.connect(_on_section_panel_gui_input)
|
|
|
|
func set_title(title):
|
|
_title.text = title
|
|
|
|
func set_minutes(minutes):
|
|
_minutes = minutes
|
|
|
|
func set_color(color):
|
|
var new_style_box: StyleBoxFlat = _panel.get("theme_override_styles/panel").duplicate()
|
|
new_style_box.bg_color = Colors[color]
|
|
_panel.set("theme_override_styles/panel", new_style_box)
|
|
|
|
func set_id(id):
|
|
_id = id
|
|
|
|
func _on_section_panel_gui_input(event):
|
|
if event is InputEventScreenTouch or (event is InputEventMouseButton and event.pressed):
|
|
print("emit open reservation info signal")
|
|
|
|
var repo = _main.get_reservation_repo()
|
|
repo.set_current_reservation_id(_id)
|
|
|
|
_main.load_page(Main.Pages.ReservationEdit, true)
|