Implemented prototype with minimal functionality
Added tablet view Added time Implemented reserve now buttons Implemented auto-scale Implemented reservation edit and deletion
This commit is contained in:
parent
4ab4992918
commit
64e0bd0a51
4
assets/themes/instant_button_font.tres
Normal file
4
assets/themes/instant_button_font.tres
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[gd_resource type="Theme" format=3 uid="uid://b8tbd62jtmgdx"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
default_font_size = 36
|
4
assets/themes/small.tres
Normal file
4
assets/themes/small.tres
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[gd_resource type="Theme" format=3 uid="uid://yn1nbokvmv6n"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
default_font_size = 30
|
4
assets/themes/status_font.tres
Normal file
4
assets/themes/status_font.tres
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[gd_resource type="Theme" format=3 uid="uid://byopik87nb8vv"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
default_font_size = 100
|
@ -8,7 +8,7 @@ custom_features=""
|
|||||||
export_filter="all_resources"
|
export_filter="all_resources"
|
||||||
include_filter=""
|
include_filter=""
|
||||||
exclude_filter=""
|
exclude_filter=""
|
||||||
export_path="./Talkpal.apk"
|
export_path="build/Talkpal.apk"
|
||||||
encryption_include_filters=""
|
encryption_include_filters=""
|
||||||
encryption_exclude_filters=""
|
encryption_exclude_filters=""
|
||||||
encrypt_pck=false
|
encrypt_pck=false
|
||||||
|
@ -11,7 +11,7 @@ config_version=5
|
|||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="Talkpal"
|
config/name="Talkpal"
|
||||||
run/main_scene="res://scenes/main/main_mobile.tscn"
|
run/main_scene="res://scenes/main/main_tablet.tscn"
|
||||||
config/features=PackedStringArray("4.2", "GL Compatibility")
|
config/features=PackedStringArray("4.2", "GL Compatibility")
|
||||||
boot_splash/bg_color=Color(0.800491, 0.800491, 0.800491, 1)
|
boot_splash/bg_color=Color(0.800491, 0.800491, 0.800491, 1)
|
||||||
boot_splash/image="res://assets/comfortel_logo.png"
|
boot_splash/image="res://assets/comfortel_logo.png"
|
||||||
|
57
scenes/board/boaB9F6.tmp
Normal file
57
scenes/board/boaB9F6.tmp
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
[gd_scene load_steps=6 format=3 uid="uid://c431r28ef5edp"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/board/board.gd" id="1_2wgc4"]
|
||||||
|
[ext_resource type="Theme" uid="uid://cmhwbyqu6nh38" path="res://assets/themes/big.tres" id="1_na0ey"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cnr23ry08ntv4" path="res://scenes/board/time_slot.tscn" id="2_kklmx"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://blv30rxduydmw" path="res://scenes/board/reservation_indent.tscn" id="3_mltgm"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dpi5ft4r8sfwb" path="res://scenes/board/reservation.tscn" id="4_o5rhy"]
|
||||||
|
|
||||||
|
[node name="Board" type="VBoxContainer"]
|
||||||
|
anchors_preset = 10
|
||||||
|
anchor_right = 1.0
|
||||||
|
offset_bottom = 75.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
theme_override_constants/separation = 50
|
||||||
|
script = ExtResource("1_2wgc4")
|
||||||
|
|
||||||
|
[node name="TopBar" type="HBoxContainer" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="RoomButton" type="Button" parent="TopBar"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("1_na0ey")
|
||||||
|
text = "Переговорка 1"
|
||||||
|
|
||||||
|
[node name="DateButton" type="Button" parent="TopBar"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 10
|
||||||
|
theme = ExtResource("1_na0ey")
|
||||||
|
text = "Вт, 14 июн. 2022"
|
||||||
|
|
||||||
|
[node name="Panel" type="Control" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Timeline" type="VBoxContainer" parent="Panel"]
|
||||||
|
layout_mode = 2
|
||||||
|
offset_top = 50.0
|
||||||
|
offset_right = 1036.0
|
||||||
|
offset_bottom = 354.0
|
||||||
|
|
||||||
|
[node name="TimeSlot" parent="Panel/Timeline" instance=ExtResource("2_kklmx")]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="TimeSlot2" parent="Panel/Timeline" instance=ExtResource("2_kklmx")]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Reservations" type="VBoxContainer" parent="Panel"]
|
||||||
|
layout_mode = 2
|
||||||
|
offset_top = 50.0
|
||||||
|
offset_right = 1036.0
|
||||||
|
offset_bottom = 117.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
|
||||||
|
[node name="Indent" parent="Panel/Reservations" instance=ExtResource("3_mltgm")]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Reservation" parent="Panel/Reservations" instance=ExtResource("4_o5rhy")]
|
||||||
|
layout_mode = 2
|
57
scenes/board/boaF00C.tmp
Normal file
57
scenes/board/boaF00C.tmp
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
[gd_scene load_steps=6 format=3 uid="uid://c431r28ef5edp"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/board/board.gd" id="1_2wgc4"]
|
||||||
|
[ext_resource type="Theme" uid="uid://cmhwbyqu6nh38" path="res://assets/themes/big.tres" id="1_na0ey"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cnr23ry08ntv4" path="res://scenes/board/time_slot.tscn" id="2_kklmx"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://blv30rxduydmw" path="res://scenes/board/reservation_indent.tscn" id="3_mltgm"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dpi5ft4r8sfwb" path="res://scenes/board/reservation.tscn" id="4_o5rhy"]
|
||||||
|
|
||||||
|
[node name="Board" type="VBoxContainer"]
|
||||||
|
anchors_preset = 10
|
||||||
|
anchor_right = 1.0
|
||||||
|
offset_bottom = 75.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
theme_override_constants/separation = 50
|
||||||
|
script = ExtResource("1_2wgc4")
|
||||||
|
|
||||||
|
[node name="TopBar" type="HBoxContainer" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="RoomButton" type="Button" parent="TopBar"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("1_na0ey")
|
||||||
|
text = "Переговорка 1"
|
||||||
|
|
||||||
|
[node name="DateButton" type="Button" parent="TopBar"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 10
|
||||||
|
theme = ExtResource("1_na0ey")
|
||||||
|
text = "Вт, 14 июн. 2022"
|
||||||
|
|
||||||
|
[node name="Panel" type="Control" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Timeline" type="VBoxContainer" parent="Panel"]
|
||||||
|
layout_mode = 2
|
||||||
|
offset_top = 50.0
|
||||||
|
offset_right = 1036.0
|
||||||
|
offset_bottom = 354.0
|
||||||
|
|
||||||
|
[node name="TimeSlot" parent="Panel/Timeline" instance=ExtResource("2_kklmx")]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="TimeSlot2" parent="Panel/Timeline" instance=ExtResource("2_kklmx")]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Reservations" type="VBoxContainer" parent="Panel"]
|
||||||
|
layout_mode = 2
|
||||||
|
offset_top = 50.0
|
||||||
|
offset_right = 1036.0
|
||||||
|
offset_bottom = 117.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
|
||||||
|
[node name="Indent" parent="Panel/Reservations" instance=ExtResource("3_mltgm")]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Reservation" parent="Panel/Reservations" instance=ExtResource("4_o5rhy")]
|
||||||
|
layout_mode = 2
|
@ -9,30 +9,24 @@ const WorkingDayEnd = 21
|
|||||||
|
|
||||||
const MinimalMinutesToShowTitle = 30
|
const MinimalMinutesToShowTitle = 30
|
||||||
|
|
||||||
const MockedSchedule = [
|
|
||||||
{
|
|
||||||
"title": "Психолог",
|
|
||||||
"start_time": 120,
|
|
||||||
"end_time": 180,
|
|
||||||
"color": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Дипал",
|
|
||||||
"start_time": 180,
|
|
||||||
"end_time": 210,
|
|
||||||
"color": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Маркетинг",
|
|
||||||
"start_time": 280,
|
|
||||||
"end_time": 325,
|
|
||||||
"color": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
@onready var _main: Main = get_tree().get_current_scene()
|
@onready var _main: Main = get_tree().get_current_scene()
|
||||||
@onready var _timeline = $Panel/Timeline
|
@onready var _timeline = $Panel/Timeline
|
||||||
@onready var _reservations = $Panel/Reservations
|
@onready var _reservations = $Panel/Reservations
|
||||||
|
@onready var _date = $TopBar/DateButton
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
_process_hour_size()
|
||||||
|
_process_date()
|
||||||
|
|
||||||
|
func _process_hour_size():
|
||||||
|
var hour_size = get_viewport_rect().size.y/15
|
||||||
|
|
||||||
|
for time_slot in _timeline.get_children():
|
||||||
|
time_slot.set_height(hour_size)
|
||||||
|
|
||||||
|
func _process_date():
|
||||||
|
var date = Time.get_date_dict_from_system()
|
||||||
|
_date.text = "%02d.%02d.%04d" % [date.day, date.month, date.year]
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
_remove_time_slots()
|
_remove_time_slots()
|
||||||
@ -74,7 +68,7 @@ func _update_schedule():
|
|||||||
var reservation_time = finish_time - start_time
|
var reservation_time = finish_time - start_time
|
||||||
|
|
||||||
_compose_indent(start_time - previous_finish_time)
|
_compose_indent(start_time - previous_finish_time)
|
||||||
_compose_reservation(reservation_time, reservation.title, reservation.color)
|
_compose_reservation(reservation_time, reservation.title, reservation.color, reservation.id)
|
||||||
|
|
||||||
previous_finish_time = finish_time
|
previous_finish_time = finish_time
|
||||||
|
|
||||||
@ -83,8 +77,8 @@ func _compose_indent(minutes):
|
|||||||
_reservations.add_child(indent)
|
_reservations.add_child(indent)
|
||||||
indent.set_minutes(minutes)
|
indent.set_minutes(minutes)
|
||||||
|
|
||||||
func _compose_reservation(minutes, title, color):
|
func _compose_reservation(minutes, title, color, id):
|
||||||
if minutes <= MinimalMinutesToShowTitle:
|
if minutes < MinimalMinutesToShowTitle:
|
||||||
title = ""
|
title = ""
|
||||||
|
|
||||||
var reservation = ReservationScene.instantiate()
|
var reservation = ReservationScene.instantiate()
|
||||||
@ -92,14 +86,30 @@ func _compose_reservation(minutes, title, color):
|
|||||||
reservation.set_minutes(minutes)
|
reservation.set_minutes(minutes)
|
||||||
reservation.set_title(title)
|
reservation.set_title(title)
|
||||||
reservation.set_color(color)
|
reservation.set_color(color)
|
||||||
|
reservation.set_id(id)
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
|
if not _main.get_current_page() == Main.Pages.Board:
|
||||||
|
return
|
||||||
|
|
||||||
if event is InputEventScreenTouch or (event is InputEventMouseButton and event.pressed):
|
if event is InputEventScreenTouch or (event is InputEventMouseButton and event.pressed):
|
||||||
if _clicked_on_timeline(event.position):
|
if _clicked_on_timeline(event.position):
|
||||||
await get_tree().create_timer(0.01, false).timeout
|
await get_tree().create_timer(0.01, false).timeout
|
||||||
|
|
||||||
if _main.get_current_page() == Main.Pages.Board:
|
if _main.get_current_page() == Main.Pages.Board:
|
||||||
_main.load_page(Main.Pages.ReservationCreation)
|
var time = _get_time_by_position(event.position)
|
||||||
|
var creation_page = _main.load_page(Main.Pages.ReservationCreation)
|
||||||
|
creation_page.set_start_time(time)
|
||||||
|
|
||||||
|
func _get_time_by_position(position):
|
||||||
|
var hour_size = get_viewport_rect().size.y / 15
|
||||||
|
var hours_with_minutes_in_float = \
|
||||||
|
(position.y - _timeline.global_position.y) / hour_size + WorkingDayStart
|
||||||
|
var hours = floor(hours_with_minutes_in_float)
|
||||||
|
var minutes = (hours_with_minutes_in_float - hours) * 60
|
||||||
|
var minutes_normalized = floor(minutes/30)*30
|
||||||
|
|
||||||
|
return {"hours": hours, "minutes": minutes_normalized}
|
||||||
|
|
||||||
func _clicked_on_timeline(pos: Vector2):
|
func _clicked_on_timeline(pos: Vector2):
|
||||||
var timeline_position = _timeline.global_position
|
var timeline_position = _timeline.global_position
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://c431r28ef5edp"]
|
[gd_scene load_steps=7 format=3 uid="uid://c431r28ef5edp"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scenes/board/board.gd" id="1_2wgc4"]
|
[ext_resource type="Script" path="res://scenes/board/board.gd" id="1_2wgc4"]
|
||||||
[ext_resource type="Theme" uid="uid://cmhwbyqu6nh38" path="res://assets/themes/big.tres" id="1_na0ey"]
|
[ext_resource type="Theme" uid="uid://cmhwbyqu6nh38" path="res://assets/themes/big.tres" id="1_na0ey"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cnr23ry08ntv4" path="res://scenes/board/time_slot.tscn" id="2_kklmx"]
|
[ext_resource type="PackedScene" uid="uid://cnr23ry08ntv4" path="res://scenes/board/time_slot.tscn" id="2_kklmx"]
|
||||||
[ext_resource type="PackedScene" uid="uid://blv30rxduydmw" path="res://scenes/board/reservation_indent.tscn" id="3_mltgm"]
|
[ext_resource type="PackedScene" uid="uid://blv30rxduydmw" path="res://scenes/board/reservation_indent.tscn" id="3_mltgm"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dpi5ft4r8sfwb" path="res://scenes/board/reservation.tscn" id="4_o5rhy"]
|
[ext_resource type="PackedScene" uid="uid://dpi5ft4r8sfwb" path="res://scenes/board/reservation.tscn" id="4_o5rhy"]
|
||||||
|
[ext_resource type="Script" path="res://scenes/board/current_time.gd" id="6_8jgig"]
|
||||||
|
|
||||||
[node name="Board" type="VBoxContainer"]
|
[node name="Board" type="VBoxContainer"]
|
||||||
anchors_preset = 10
|
anchors_preset = 10
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
offset_bottom = 75.0
|
offset_bottom = 75.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
theme_override_constants/separation = 50
|
theme_override_constants/separation = 25
|
||||||
script = ExtResource("1_2wgc4")
|
script = ExtResource("1_2wgc4")
|
||||||
|
|
||||||
[node name="TopBar" type="HBoxContainer" parent="."]
|
[node name="TopBar" type="HBoxContainer" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="RoomButton" type="Button" parent="TopBar"]
|
[node name="RoomButton" type="Button" parent="TopBar"]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme = ExtResource("1_na0ey")
|
theme = ExtResource("1_na0ey")
|
||||||
text = "Переговорка 1"
|
text = "Переговорка 1"
|
||||||
@ -43,6 +45,37 @@ layout_mode = 2
|
|||||||
[node name="TimeSlot2" parent="Panel/Timeline" instance=ExtResource("2_kklmx")]
|
[node name="TimeSlot2" parent="Panel/Timeline" instance=ExtResource("2_kklmx")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="CurrentTime" type="VBoxContainer" parent="Panel"]
|
||||||
|
custom_minimum_size = Vector2(1036, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
offset_top = 50.0
|
||||||
|
offset_right = 1036.0
|
||||||
|
offset_bottom = 318.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
script = ExtResource("6_8jgig")
|
||||||
|
|
||||||
|
[node name="Background" type="ColorRect" parent="Panel/CurrentTime"]
|
||||||
|
custom_minimum_size = Vector2(0, 200)
|
||||||
|
layout_mode = 2
|
||||||
|
mouse_filter = 1
|
||||||
|
color = Color(0, 0, 0, 0.470588)
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="Panel/CurrentTime"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Indent" type="Label" parent="Panel/CurrentTime/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("1_na0ey")
|
||||||
|
theme_override_colors/font_color = Color(0, 0, 0, 0)
|
||||||
|
text = "11:00 "
|
||||||
|
|
||||||
|
[node name="Handler" type="ColorRect" parent="Panel/CurrentTime/HBoxContainer"]
|
||||||
|
custom_minimum_size = Vector2(0, 5)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 0
|
||||||
|
color = Color(1, 1, 1, 0.556863)
|
||||||
|
|
||||||
[node name="Reservations" type="VBoxContainer" parent="Panel"]
|
[node name="Reservations" type="VBoxContainer" parent="Panel"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
offset_top = 50.0
|
offset_top = 50.0
|
||||||
|
25
scenes/board/current_time.gd
Normal file
25
scenes/board/current_time.gd
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
extends VBoxContainer
|
||||||
|
|
||||||
|
const WorkingDayStart = 8
|
||||||
|
const WorkingDayEnd = 20
|
||||||
|
|
||||||
|
@onready var _bg := $Background
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
_process_current_time()
|
||||||
|
|
||||||
|
func _process_current_time():
|
||||||
|
var time = Time.get_time_dict_from_system()
|
||||||
|
|
||||||
|
if time.hour < WorkingDayStart or time.hour > WorkingDayEnd:
|
||||||
|
_set_current_time(0)
|
||||||
|
return
|
||||||
|
|
||||||
|
_set_current_time(time.hour*60 + time.minute - WorkingDayStart*60)
|
||||||
|
|
||||||
|
func _set_current_time(minutes):
|
||||||
|
if minutes == 0:
|
||||||
|
_bg.custom_minimum_size.y = 0
|
||||||
|
else:
|
||||||
|
var hour_size = get_viewport_rect().size.y/15
|
||||||
|
_bg.custom_minimum_size.y = minutes * hour_size / 60
|
@ -1,8 +1,6 @@
|
|||||||
extends HBoxContainer
|
extends HBoxContainer
|
||||||
class_name Reservation
|
class_name Reservation
|
||||||
|
|
||||||
const HourSize = 150
|
|
||||||
|
|
||||||
const Colors = {
|
const Colors = {
|
||||||
1: Color("00b1a1d6"),
|
1: Color("00b1a1d6"),
|
||||||
2: Color("f431e0d6"),
|
2: Color("f431e0d6"),
|
||||||
@ -13,9 +11,21 @@ const Colors = {
|
|||||||
@onready var _title = $Section/SectionLabel
|
@onready var _title = $Section/SectionLabel
|
||||||
@onready var _panel = $Section/SectionPanel
|
@onready var _panel = $Section/SectionPanel
|
||||||
|
|
||||||
|
var _hour_size : int
|
||||||
|
var _minutes : int
|
||||||
|
var _id : String
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
initialize_signals()
|
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():
|
func initialize_signals():
|
||||||
_panel.gui_input.connect(_on_section_panel_gui_input)
|
_panel.gui_input.connect(_on_section_panel_gui_input)
|
||||||
|
|
||||||
@ -23,14 +33,21 @@ func set_title(title):
|
|||||||
_title.text = title
|
_title.text = title
|
||||||
|
|
||||||
func set_minutes(minutes):
|
func set_minutes(minutes):
|
||||||
_panel.size.y = minutes * HourSize / 60
|
_minutes = minutes
|
||||||
custom_minimum_size.y = _panel.size.y
|
|
||||||
|
|
||||||
func set_color(color):
|
func set_color(color):
|
||||||
var new_style_box: StyleBoxFlat = _panel.get("theme_override_styles/panel").duplicate()
|
var new_style_box: StyleBoxFlat = _panel.get("theme_override_styles/panel").duplicate()
|
||||||
new_style_box.bg_color = Colors[color]
|
new_style_box.bg_color = Colors[color]
|
||||||
_panel.set("theme_override_styles/panel", new_style_box)
|
_panel.set("theme_override_styles/panel", new_style_box)
|
||||||
|
|
||||||
|
func set_id(id):
|
||||||
|
_id = id
|
||||||
|
|
||||||
func _on_section_panel_gui_input(event):
|
func _on_section_panel_gui_input(event):
|
||||||
if event is InputEventScreenTouch or (event is InputEventMouseButton and event.pressed):
|
if event is InputEventScreenTouch or (event is InputEventMouseButton and event.pressed):
|
||||||
print("emit open reservation info signal")
|
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)
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
const HourSize = 150
|
var _minutes : int
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
var hour_size = get_viewport_rect().size.y/15
|
||||||
|
var additional_height = get_viewport_rect().size.y/468
|
||||||
|
custom_minimum_size.y = _minutes * hour_size / 60 + additional_height
|
||||||
|
|
||||||
func set_minutes(minutes):
|
func set_minutes(minutes):
|
||||||
custom_minimum_size.y = minutes * HourSize / 60
|
_minutes = minutes
|
||||||
|
@ -1,6 +1,23 @@
|
|||||||
|
@tool
|
||||||
extends HBoxContainer
|
extends HBoxContainer
|
||||||
|
|
||||||
@onready var _time_label = $TimeLabelControl/TimeLabel
|
@onready var _time_label = $TimeLabelControl/TimeLabel
|
||||||
|
|
||||||
|
@export var height : int:
|
||||||
|
set(new_height):
|
||||||
|
height = new_height
|
||||||
|
await ready
|
||||||
|
set_height(height)
|
||||||
|
|
||||||
|
var _height : int
|
||||||
|
|
||||||
func set_time(hour):
|
func set_time(hour):
|
||||||
_time_label.text = str(hour) + ":00"
|
_time_label.text = str(hour) + ":00"
|
||||||
|
|
||||||
|
func get_height():
|
||||||
|
return _height
|
||||||
|
|
||||||
|
func set_height(new_height):
|
||||||
|
if _height != new_height:
|
||||||
|
_height = new_height
|
||||||
|
custom_minimum_size.y = _height
|
||||||
|
@ -18,8 +18,14 @@ corner_radius_bottom_left = 5
|
|||||||
custom_minimum_size = Vector2(0, 150)
|
custom_minimum_size = Vector2(0, 150)
|
||||||
theme_override_constants/separation = 25
|
theme_override_constants/separation = 25
|
||||||
script = ExtResource("1_hwvwy")
|
script = ExtResource("1_hwvwy")
|
||||||
|
height = 150
|
||||||
|
|
||||||
|
[node name="NewIndent" type="Control" parent="."]
|
||||||
|
custom_minimum_size = Vector2(100, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="Indent" type="Label" parent="."]
|
[node name="Indent" type="Label" parent="."]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme = ExtResource("2_ty4oc")
|
theme = ExtResource("2_ty4oc")
|
||||||
text = " "
|
text = " "
|
||||||
@ -46,17 +52,3 @@ text = "11:00"
|
|||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_pfkqv")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_pfkqv")
|
||||||
|
|
||||||
[node name="EventsContainer" type="GridContainer" parent="."]
|
|
||||||
visible = false
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Event" type="Button" parent="EventsContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
theme = ExtResource("2_ty4oc")
|
|
||||||
text = "Переговоры с Клиентами"
|
|
||||||
|
|
||||||
[node name="Event2" type="Button" parent="EventsContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
theme = ExtResource("2_ty4oc")
|
|
||||||
text = "Интервью C#"
|
|
||||||
|
@ -18,6 +18,11 @@ enum Type {
|
|||||||
type = value
|
type = value
|
||||||
set_type(type)
|
set_type(type)
|
||||||
|
|
||||||
|
@export var editable : bool = true:
|
||||||
|
set(value):
|
||||||
|
editable = value
|
||||||
|
set_editable(value)
|
||||||
|
|
||||||
@onready var _label = $FieldLabelControl/FieldLabel
|
@onready var _label = $FieldLabelControl/FieldLabel
|
||||||
@onready var _line = $Line
|
@onready var _line = $Line
|
||||||
@onready var _calendar = $Calendar
|
@onready var _calendar = $Calendar
|
||||||
@ -51,7 +56,23 @@ func get_value():
|
|||||||
}
|
}
|
||||||
|
|
||||||
func set_value(value):
|
func set_value(value):
|
||||||
|
match _type:
|
||||||
|
Type.Line:
|
||||||
_line.text = value
|
_line.text = value
|
||||||
|
Type.Text:
|
||||||
|
_text.text = value
|
||||||
|
Type.Calendar:
|
||||||
|
pass
|
||||||
|
Type.Time:
|
||||||
|
_time.set_time(value.hours, value.minutes)
|
||||||
|
|
||||||
|
func set_editable(value):
|
||||||
|
if _line == null:
|
||||||
|
await ready
|
||||||
|
|
||||||
|
_line.editable = value
|
||||||
|
_text.editable = value
|
||||||
|
_time.editable = value
|
||||||
|
|
||||||
func set_type(type):
|
func set_type(type):
|
||||||
if _line == null:
|
if _line == null:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://d0fdiesiaajlq"]
|
[gd_scene load_steps=6 format=3 uid="uid://d0fdiesiaajlq"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scenes/common/edit_field.gd" id="1_sdy7t"]
|
[ext_resource type="Script" path="res://scenes/common/edit_field.gd" id="1_sdy7t"]
|
||||||
[ext_resource type="Theme" uid="uid://7lcget51crj1" path="res://assets/themes/medium.tres" id="1_v1b42"]
|
[ext_resource type="Theme" uid="uid://7lcget51crj1" path="res://assets/themes/medium.tres" id="2_haj3x"]
|
||||||
[ext_resource type="Theme" uid="uid://cmhwbyqu6nh38" path="res://assets/themes/big.tres" id="2_iq8f3"]
|
[ext_resource type="Theme" uid="uid://cmhwbyqu6nh38" path="res://assets/themes/big.tres" id="2_iq8f3"]
|
||||||
[ext_resource type="PackedScene" uid="uid://drdv8adk1wi8f" path="res://scenes/common/calendar/calendar_edit.tscn" id="4_hlx5p"]
|
[ext_resource type="PackedScene" uid="uid://drdv8adk1wi8f" path="res://scenes/common/calendar/calendar_edit.tscn" id="4_hlx5p"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bhd0xvnvoqslr" path="res://scenes/common/time/time_edit.tscn" id="5_d0drs"]
|
[ext_resource type="PackedScene" uid="uid://bhd0xvnvoqslr" path="res://scenes/common/time/time_edit.tscn" id="5_d0drs"]
|
||||||
@ -23,7 +23,7 @@ offset_left = 25.0
|
|||||||
offset_top = 4.0
|
offset_top = 4.0
|
||||||
offset_right = 231.0
|
offset_right = 231.0
|
||||||
offset_bottom = 62.0
|
offset_bottom = 62.0
|
||||||
theme = ExtResource("1_v1b42")
|
theme = ExtResource("2_haj3x")
|
||||||
|
|
||||||
[node name="Indent" type="Label" parent="."]
|
[node name="Indent" type="Label" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
@ -3,6 +3,11 @@ extends Control
|
|||||||
@onready var _main: Main = get_tree().get_current_scene()
|
@onready var _main: Main = get_tree().get_current_scene()
|
||||||
@onready var _edit := $Edit
|
@onready var _edit := $Edit
|
||||||
|
|
||||||
|
@export var editable : bool:
|
||||||
|
set(value):
|
||||||
|
editable = value
|
||||||
|
set_editable(value)
|
||||||
|
|
||||||
var _hours := 0
|
var _hours := 0
|
||||||
var _minutes := 0
|
var _minutes := 0
|
||||||
var _time_setting_page
|
var _time_setting_page
|
||||||
@ -22,6 +27,9 @@ func _on_click():
|
|||||||
|
|
||||||
func _on_time_is_set(hours: int, minutes: int):
|
func _on_time_is_set(hours: int, minutes: int):
|
||||||
_time_setting_page.time_is_set.disconnect(_on_time_is_set)
|
_time_setting_page.time_is_set.disconnect(_on_time_is_set)
|
||||||
|
set_time(hours, minutes)
|
||||||
|
|
||||||
|
func set_time(hours: int, minutes: int):
|
||||||
_edit.text = str(hours) + ":" + _correct_minutes(str(minutes))
|
_edit.text = str(hours) + ":" + _correct_minutes(str(minutes))
|
||||||
_hours = hours
|
_hours = hours
|
||||||
_minutes = minutes
|
_minutes = minutes
|
||||||
@ -35,6 +43,9 @@ func get_hours():
|
|||||||
func get_minutes():
|
func get_minutes():
|
||||||
return _minutes
|
return _minutes
|
||||||
|
|
||||||
|
func set_editable(value):
|
||||||
|
_edit.editable = value
|
||||||
|
|
||||||
func clean():
|
func clean():
|
||||||
_hours = 0
|
_hours = 0
|
||||||
_minutes = 0
|
_minutes = 0
|
||||||
|
@ -14,7 +14,7 @@ script = ExtResource("1_2wxyg")
|
|||||||
[node name="TimeEdit" type="LineEdit" parent="."]
|
[node name="TimeEdit" type="LineEdit" parent="."]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "21:15 "
|
text = "12:07 "
|
||||||
placeholder_text = "hh:mm (a/p)m"
|
placeholder_text = "hh:mm (a/p)m"
|
||||||
script = ExtResource("2_7d4ae")
|
script = ExtResource("2_7d4ae")
|
||||||
current_time = true
|
current_time = true
|
||||||
|
@ -103,7 +103,7 @@ func _input(event):
|
|||||||
set_minutes(number.get_value())
|
set_minutes(number.get_value())
|
||||||
time_is_set.emit(_hours, _minutes)
|
time_is_set.emit(_hours, _minutes)
|
||||||
await get_tree().create_timer(0.01, false).timeout
|
await get_tree().create_timer(0.01, false).timeout
|
||||||
_main.go_to_previous_page()
|
_main.go_to_previous_page(false)
|
||||||
_ready()
|
_ready()
|
||||||
|
|
||||||
elif _clicked_on_time(event.position):
|
elif _clicked_on_time(event.position):
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[ext_resource type="Script" path="res://scenes/common/time/time_setting.gd" id="1_2uqfu"]
|
[ext_resource type="Script" path="res://scenes/common/time/time_setting.gd" id="1_2uqfu"]
|
||||||
[ext_resource type="Texture2D" uid="uid://d0llucl6yfmwj" path="res://assets/textures/time_setting.tres" id="2_6xoc0"]
|
[ext_resource type="Texture2D" uid="uid://d0llucl6yfmwj" path="res://assets/textures/time_setting.tres" id="2_6xoc0"]
|
||||||
[ext_resource type="Theme" uid="uid://c5nehi7j4wsjd" path="res://assets/themes/time_font.tres" id="3_gngar"]
|
[ext_resource type="Theme" uid="uid://byopik87nb8vv" path="res://assets/themes/status_font.tres" id="2_84auh"]
|
||||||
[ext_resource type="PackedScene" uid="uid://3omkos3a4po7" path="res://scenes/common/time/time_hand.tscn" id="4_g84y5"]
|
[ext_resource type="PackedScene" uid="uid://3omkos3a4po7" path="res://scenes/common/time/time_hand.tscn" id="4_g84y5"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_23ktd"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_23ktd"]
|
||||||
@ -41,7 +41,7 @@ grow_vertical = 2
|
|||||||
|
|
||||||
[node name="Time" type="HBoxContainer" parent="VerticalBar"]
|
[node name="Time" type="HBoxContainer" parent="VerticalBar"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme = ExtResource("3_gngar")
|
theme = ExtResource("2_84auh")
|
||||||
alignment = 1
|
alignment = 1
|
||||||
|
|
||||||
[node name="Hours" type="Label" parent="VerticalBar/Time"]
|
[node name="Hours" type="Label" parent="VerticalBar/Time"]
|
||||||
|
99
scenes/main/mai1DAE.tmp
Normal file
99
scenes/main/mai1DAE.tmp
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
[gd_scene load_steps=9 format=3 uid="uid://bkrvh8vjpgqot"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/main/main_tablet.gd" id="1_fr6s5"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c431r28ef5edp" path="res://scenes/board/board.tscn" id="2_n47h4"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://csfn8q6b5hj4y" path="res://scenes/reservation/reservation_creation.tscn" id="3_j6x1g"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cu6e3hfdorwcg" path="res://scenes/reservation/reservation_edit.tscn" id="4_hyj5n"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cxs8xe5w32jo4" path="res://scenes/common/time/time_setting.tscn" id="4_wyf5q"]
|
||||||
|
[ext_resource type="Script" path="res://src/infra/repos/local/reservation.gd" id="5_6h0eq"]
|
||||||
|
[ext_resource type="Theme" uid="uid://byopik87nb8vv" path="res://assets/themes/status_font.tres" id="5_atujq"]
|
||||||
|
[ext_resource type="Theme" uid="uid://yn1nbokvmv6n" path="res://assets/themes/small.tres" id="6_nde4h"]
|
||||||
|
|
||||||
|
[node name="Main" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchor_left = 0.02
|
||||||
|
anchor_top = 0.01
|
||||||
|
anchor_right = 0.98
|
||||||
|
anchor_bottom = 0.99
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_fr6s5")
|
||||||
|
|
||||||
|
[node name="Background" type="ColorRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
color = Color(0.133333, 0.14902, 0.176471, 1)
|
||||||
|
|
||||||
|
[node name="Left" type="HBoxContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 9
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_right = 1576.0
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="Pages" type="BoxContainer" parent="Left"]
|
||||||
|
custom_minimum_size = Vector2(1200, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Board" parent="Left/Pages" instance=ExtResource("2_n47h4")]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="ReservationCreation" parent="Left/Pages" instance=ExtResource("3_j6x1g")]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="ReservationEdit" parent="Left/Pages" instance=ExtResource("4_hyj5n")]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="TimeSetting" parent="Left/Pages" instance=ExtResource("4_wyf5q")]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="TimeStatusContainer" type="VBoxContainer" parent="Left"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Indent" type="BoxContainer" parent="Left/TimeStatusContainer"]
|
||||||
|
custom_minimum_size = Vector2(0, 206.667)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="TimeLabel" type="Label" parent="Left/TimeStatusContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("5_atujq")
|
||||||
|
text = "13:48"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="StatusLabel" type="Label" parent="Left/TimeStatusContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("5_atujq")
|
||||||
|
text = "Свободно"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="InstantButtons" type="HBoxContainer" parent="Left/TimeStatusContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("6_nde4h")
|
||||||
|
|
||||||
|
[node name="15min" type="Button" parent="Left/TimeStatusContainer/InstantButtons"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "+15 мин"
|
||||||
|
|
||||||
|
[node name="30min" type="Button" parent="Left/TimeStatusContainer/InstantButtons"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "+30 мин"
|
||||||
|
|
||||||
|
[node name="45min" type="Button" parent="Left/TimeStatusContainer/InstantButtons"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "+45 мин"
|
||||||
|
|
||||||
|
[node name="1h" type="Button" parent="Left/TimeStatusContainer/InstantButtons"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "+1 час"
|
||||||
|
|
||||||
|
[node name="Repos" type="Node" parent="."]
|
||||||
|
|
||||||
|
[node name="Reservation" type="Node" parent="Repos"]
|
||||||
|
script = ExtResource("5_6h0eq")
|
59
scenes/main/maiC11D.tmp
Normal file
59
scenes/main/maiC11D.tmp
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
[gd_scene load_steps=6 format=3 uid="uid://bkrvh8vjpgqot"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/main/main_tablet.gd" id="1_fr6s5"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c431r28ef5edp" path="res://scenes/board/board.tscn" id="2_n47h4"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://csfn8q6b5hj4y" path="res://scenes/reservation/reservation_creation.tscn" id="3_j6x1g"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cxs8xe5w32jo4" path="res://scenes/common/time/time_setting.tscn" id="4_wyf5q"]
|
||||||
|
[ext_resource type="Script" path="res://src/infra/repos/local/reservation.gd" id="5_6h0eq"]
|
||||||
|
|
||||||
|
[node name="Main" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchor_left = 0.02
|
||||||
|
anchor_top = 0.01
|
||||||
|
anchor_right = 0.98
|
||||||
|
anchor_bottom = 0.99
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_fr6s5")
|
||||||
|
|
||||||
|
[node name="BackgroundColor" type="ColorRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
color = Color(0.133333, 0.14902, 0.176471, 1)
|
||||||
|
|
||||||
|
[node name="Left" type="BoxContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 9
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="Pages" type="Control" parent="Left"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Board" parent="Left/Pages" instance=ExtResource("2_n47h4")]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_bottom = 0.0
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="ReservationCreation" parent="Left/Pages" instance=ExtResource("3_j6x1g")]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_bottom = 0.0
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="TimeSetting" parent="Left/Pages" instance=ExtResource("4_wyf5q")]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 1
|
||||||
|
|
||||||
|
[node name="Repos" type="Node" parent="."]
|
||||||
|
|
||||||
|
[node name="Reservation" type="Node" parent="Repos"]
|
||||||
|
script = ExtResource("5_6h0eq")
|
21
scenes/main/main.gd
Normal file
21
scenes/main/main.gd
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
extends Control
|
||||||
|
class_name Main
|
||||||
|
|
||||||
|
enum Pages {
|
||||||
|
Board,
|
||||||
|
ReservationCreation,
|
||||||
|
ReservationEdit,
|
||||||
|
TimeSetting
|
||||||
|
}
|
||||||
|
|
||||||
|
func get_current_page():
|
||||||
|
pass
|
||||||
|
|
||||||
|
func load_page(value, with_update=true):
|
||||||
|
pass
|
||||||
|
|
||||||
|
func go_to_previous_page(with_update=true):
|
||||||
|
pass
|
||||||
|
|
||||||
|
func get_reservation_repo() -> AbstractReservationRepo:
|
||||||
|
return AbstractReservationRepo.new()
|
@ -1,12 +1,6 @@
|
|||||||
@tool
|
@tool
|
||||||
extends Control
|
extends Main
|
||||||
class_name Main
|
class_name MainMobile
|
||||||
|
|
||||||
enum Pages {
|
|
||||||
Board,
|
|
||||||
ReservationCreation,
|
|
||||||
TimeSetting
|
|
||||||
}
|
|
||||||
|
|
||||||
@onready var _reservation_repo : AbstractReservationRepo = $Repos/Reservation
|
@onready var _reservation_repo : AbstractReservationRepo = $Repos/Reservation
|
||||||
|
|
||||||
@ -40,9 +34,9 @@ func load_page(value, with_update=true):
|
|||||||
|
|
||||||
return _pages[_current_page]
|
return _pages[_current_page]
|
||||||
|
|
||||||
func go_to_previous_page():
|
func go_to_previous_page(with_update=true):
|
||||||
if _previous_page != null:
|
if _previous_page != null:
|
||||||
load_page(_previous_page)
|
load_page(_previous_page, with_update)
|
||||||
|
|
||||||
func get_reservation_repo() -> AbstractReservationRepo:
|
func get_reservation_repo() -> AbstractReservationRepo:
|
||||||
return _reservation_repo
|
return _reservation_repo
|
||||||
|
158
scenes/main/main_tablet.gd
Normal file
158
scenes/main/main_tablet.gd
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
@tool
|
||||||
|
extends Main
|
||||||
|
class_name MainTablet
|
||||||
|
|
||||||
|
const BgColors = {
|
||||||
|
"standart": Color("22262d"),
|
||||||
|
"busy": Color("4e0003"),
|
||||||
|
"free": Color("003c18"),
|
||||||
|
"temporarily_free": Color("3a2c00")
|
||||||
|
}
|
||||||
|
const MinutesForTemporarilyFree := 15
|
||||||
|
|
||||||
|
@onready var _reservation_repo : AbstractReservationRepo = $Repos/Reservation
|
||||||
|
|
||||||
|
@export var current_page : Pages:
|
||||||
|
set(value):
|
||||||
|
current_page = value
|
||||||
|
load_page(value, false)
|
||||||
|
|
||||||
|
@onready var _pages := {
|
||||||
|
Pages.Board: $Left/Pages/Board,
|
||||||
|
Pages.ReservationCreation: $Left/Pages/ReservationCreation,
|
||||||
|
Pages.ReservationEdit: $Left/Pages/ReservationEdit,
|
||||||
|
Pages.TimeSetting: $Left/Pages/TimeSetting
|
||||||
|
}
|
||||||
|
@onready var _time_status_indent := $Left/TimeStatusContainer/Indent
|
||||||
|
@onready var _time_label := $Left/TimeStatusContainer/TimeLabel
|
||||||
|
@onready var _status_label := $Left/TimeStatusContainer/StatusLabel
|
||||||
|
@onready var _background := $Background
|
||||||
|
|
||||||
|
@onready var _create_reservation_button := $RightBottom/CreateReservationButton
|
||||||
|
@onready var _15_min_button := $Left/TimeStatusContainer/ReserveNowBox/InstantButtons/_15min
|
||||||
|
@onready var _30_min_button := $Left/TimeStatusContainer/ReserveNowBox/InstantButtons/_30min
|
||||||
|
@onready var _45_min_button := $Left/TimeStatusContainer/ReserveNowBox/InstantButtons/_45min
|
||||||
|
@onready var _1_hour_button := $Left/TimeStatusContainer/ReserveNowBox/InstantButtons/_1h
|
||||||
|
|
||||||
|
var _current_page := Pages.Board
|
||||||
|
var _previous_page : Pages
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
initialize_signals()
|
||||||
|
|
||||||
|
func initialize_signals():
|
||||||
|
_create_reservation_button.pressed.connect(_on_create_reservation_button_pressed)
|
||||||
|
_15_min_button.pressed.connect(_on_15_min_button_pressed)
|
||||||
|
_30_min_button.pressed.connect(_on_30_min_button_pressed)
|
||||||
|
_45_min_button.pressed.connect(_on_45_min_button_pressed)
|
||||||
|
_1_hour_button.pressed.connect(_on_1_hour_button_pressed)
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
_process_time_status_indent()
|
||||||
|
|
||||||
|
var time = Time.get_time_dict_from_system()
|
||||||
|
_process_time(time)
|
||||||
|
_process_status(time)
|
||||||
|
|
||||||
|
func _process_time_status_indent():
|
||||||
|
var indent = get_viewport_rect().size.y/3
|
||||||
|
if _get_time_status_indent() != indent:
|
||||||
|
_set_time_status_indent(indent)
|
||||||
|
|
||||||
|
func _process_time(time):
|
||||||
|
_time_label.text = "%02d:%02d" % [time.hour, time.minute]
|
||||||
|
|
||||||
|
func _process_status(time):
|
||||||
|
var reservations = _reservation_repo.list_reservations()
|
||||||
|
var current_time_in_minutes = time.hour*60 + time.minute
|
||||||
|
|
||||||
|
for reservation in reservations:
|
||||||
|
var start_time_in_minutes = reservation.start_time.hours*60 + reservation.start_time.minutes
|
||||||
|
var finish_time_in_minutes = reservation.finish_time.hours*60 + reservation.finish_time.minutes
|
||||||
|
|
||||||
|
if current_time_in_minutes >= start_time_in_minutes \
|
||||||
|
and current_time_in_minutes < finish_time_in_minutes:
|
||||||
|
_status_label.text = "Занято"
|
||||||
|
_background.color = BgColors.busy
|
||||||
|
return
|
||||||
|
|
||||||
|
elif current_time_in_minutes <= start_time_in_minutes \
|
||||||
|
and current_time_in_minutes + MinutesForTemporarilyFree > start_time_in_minutes:
|
||||||
|
_status_label.text = "Свободно"
|
||||||
|
_background.color = BgColors.temporarily_free
|
||||||
|
return
|
||||||
|
|
||||||
|
if len(reservations) > 0:
|
||||||
|
_status_label.text = "Свободно"
|
||||||
|
_background.color = BgColors.free
|
||||||
|
else:
|
||||||
|
_status_label.text = "Свободно"
|
||||||
|
_background.color = BgColors.standart
|
||||||
|
|
||||||
|
func get_current_page():
|
||||||
|
return _current_page
|
||||||
|
|
||||||
|
func load_page(value, with_update=true):
|
||||||
|
_pages[_current_page].visible = false
|
||||||
|
|
||||||
|
if _previous_page != _current_page:
|
||||||
|
_previous_page = _current_page
|
||||||
|
|
||||||
|
_current_page = value
|
||||||
|
if with_update:
|
||||||
|
_pages[_current_page].update()
|
||||||
|
_pages[_current_page].visible = true
|
||||||
|
|
||||||
|
return _pages[_current_page]
|
||||||
|
|
||||||
|
func go_to_previous_page(with_update=true):
|
||||||
|
if _previous_page != null:
|
||||||
|
load_page(_previous_page, with_update)
|
||||||
|
|
||||||
|
func get_reservation_repo() -> AbstractReservationRepo:
|
||||||
|
return _reservation_repo
|
||||||
|
|
||||||
|
func _set_time_status_indent(value):
|
||||||
|
_time_status_indent.custom_minimum_size.y = value
|
||||||
|
|
||||||
|
func _get_time_status_indent():
|
||||||
|
return _time_status_indent.custom_minimum_size.y
|
||||||
|
|
||||||
|
func _create_default_reservation(minutes_of_reservation):
|
||||||
|
var datetime = Time.get_datetime_dict_from_system()
|
||||||
|
var start_time_in_minutes = datetime.hour * 60 + datetime.minute
|
||||||
|
var finish_time_in_minutes = start_time_in_minutes + minutes_of_reservation
|
||||||
|
var finish_time_hours = floor(finish_time_in_minutes/60)
|
||||||
|
var finish_time_minutes = finish_time_in_minutes - finish_time_hours * 60
|
||||||
|
|
||||||
|
var dto = CreateReservationDTO.new()
|
||||||
|
dto.title = ""
|
||||||
|
dto.date = "%02d.%02d.%04d" % [datetime.day, datetime.month, datetime.year]
|
||||||
|
dto.start_time = {"hours": datetime.hour, "minutes": datetime.minute}
|
||||||
|
dto.finish_time = {"hours": finish_time_hours, "minutes": finish_time_minutes}
|
||||||
|
dto.creator = ""
|
||||||
|
dto.room_id = "" # TODO: make it listbox
|
||||||
|
dto.description = ""
|
||||||
|
dto.color = randi_range(1, 3)
|
||||||
|
|
||||||
|
var repo = get_reservation_repo()
|
||||||
|
repo.create_reservation(dto)
|
||||||
|
|
||||||
|
dto.queue_free()
|
||||||
|
|
||||||
|
load_page(Main.Pages.Board, true)
|
||||||
|
|
||||||
|
func _on_create_reservation_button_pressed():
|
||||||
|
load_page(Pages.ReservationCreation)
|
||||||
|
|
||||||
|
func _on_15_min_button_pressed():
|
||||||
|
_create_default_reservation(15)
|
||||||
|
|
||||||
|
func _on_30_min_button_pressed():
|
||||||
|
_create_default_reservation(30)
|
||||||
|
|
||||||
|
func _on_45_min_button_pressed():
|
||||||
|
_create_default_reservation(45)
|
||||||
|
|
||||||
|
func _on_1_hour_button_pressed():
|
||||||
|
_create_default_reservation(60)
|
140
scenes/main/main_tablet.tscn
Normal file
140
scenes/main/main_tablet.tscn
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
[gd_scene load_steps=12 format=3 uid="uid://bkrvh8vjpgqot"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/main/main_tablet.gd" id="1_fr6s5"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c431r28ef5edp" path="res://scenes/board/board.tscn" id="2_n47h4"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://csfn8q6b5hj4y" path="res://scenes/reservation/reservation_creation.tscn" id="3_j6x1g"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cu6e3hfdorwcg" path="res://scenes/reservation/reservation_edit.tscn" id="4_hyj5n"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cxs8xe5w32jo4" path="res://scenes/common/time/time_setting.tscn" id="4_wyf5q"]
|
||||||
|
[ext_resource type="Script" path="res://src/infra/repos/local/reservation.gd" id="5_6h0eq"]
|
||||||
|
[ext_resource type="Theme" uid="uid://byopik87nb8vv" path="res://assets/themes/status_font.tres" id="5_atujq"]
|
||||||
|
[ext_resource type="Theme" uid="uid://yn1nbokvmv6n" path="res://assets/themes/small.tres" id="6_nde4h"]
|
||||||
|
[ext_resource type="Theme" uid="uid://b8tbd62jtmgdx" path="res://assets/themes/instant_button_font.tres" id="8_bmn8p"]
|
||||||
|
[ext_resource type="Theme" uid="uid://cmhwbyqu6nh38" path="res://assets/themes/big.tres" id="9_wpf8g"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_uus54"]
|
||||||
|
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||||
|
border_width_top = 3
|
||||||
|
border_color = Color(0.8, 0.8, 0.8, 0.392157)
|
||||||
|
|
||||||
|
[node name="Main" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchor_left = 0.02
|
||||||
|
anchor_top = 0.01
|
||||||
|
anchor_right = 0.98
|
||||||
|
anchor_bottom = 0.99
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_fr6s5")
|
||||||
|
|
||||||
|
[node name="Background" type="ColorRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
color = Color(0.133333, 0.14902, 0.176471, 1)
|
||||||
|
|
||||||
|
[node name="Left" type="HBoxContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 9
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_right = 1576.0
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="Pages" type="BoxContainer" parent="Left"]
|
||||||
|
custom_minimum_size = Vector2(1200, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Board" parent="Left/Pages" instance=ExtResource("2_n47h4")]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="ReservationCreation" parent="Left/Pages" instance=ExtResource("3_j6x1g")]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="ReservationEdit" parent="Left/Pages" instance=ExtResource("4_hyj5n")]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="TimeSetting" parent="Left/Pages" instance=ExtResource("4_wyf5q")]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="TimeStatusContainer" type="VBoxContainer" parent="Left"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Indent" type="BoxContainer" parent="Left/TimeStatusContainer"]
|
||||||
|
custom_minimum_size = Vector2(0, 206.667)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="TimeLabel" type="Label" parent="Left/TimeStatusContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("5_atujq")
|
||||||
|
text = "23:32"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="StatusLabel" type="Label" parent="Left/TimeStatusContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("5_atujq")
|
||||||
|
text = "Свободно"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="ReserveNowBox" type="VBoxContainer" parent="Left/TimeStatusContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 20
|
||||||
|
|
||||||
|
[node name="Splitter3" type="Panel" parent="Left/TimeStatusContainer/ReserveNowBox"]
|
||||||
|
custom_minimum_size = Vector2(0, 5)
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_uus54")
|
||||||
|
|
||||||
|
[node name="ReserveNowLabel" type="Label" parent="Left/TimeStatusContainer/ReserveNowBox"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("6_nde4h")
|
||||||
|
text = "Забронировать сейчас на"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="InstantButtons" type="HBoxContainer" parent="Left/TimeStatusContainer/ReserveNowBox"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("8_bmn8p")
|
||||||
|
theme_override_constants/separation = 25
|
||||||
|
|
||||||
|
[node name="_15min" type="Button" parent="Left/TimeStatusContainer/ReserveNowBox/InstantButtons"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "15 мин"
|
||||||
|
|
||||||
|
[node name="_30min" type="Button" parent="Left/TimeStatusContainer/ReserveNowBox/InstantButtons"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "30 мин"
|
||||||
|
|
||||||
|
[node name="_45min" type="Button" parent="Left/TimeStatusContainer/ReserveNowBox/InstantButtons"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "45 мин"
|
||||||
|
|
||||||
|
[node name="_1h" type="Button" parent="Left/TimeStatusContainer/ReserveNowBox/InstantButtons"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "1 час"
|
||||||
|
|
||||||
|
[node name="RightBottom" type="BoxContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 3
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = -40.0
|
||||||
|
offset_top = -40.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 0
|
||||||
|
|
||||||
|
[node name="CreateReservationButton" type="Button" parent="RightBottom"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("9_wpf8g")
|
||||||
|
text = "Забронировать"
|
||||||
|
|
||||||
|
[node name="Repos" type="Node" parent="."]
|
||||||
|
|
||||||
|
[node name="Reservation" type="Node" parent="Repos"]
|
||||||
|
script = ExtResource("5_6h0eq")
|
@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://csfn8q6b5hj4y"]
|
[gd_scene load_steps=7 format=3 uid="uid://csfn8q6b5hj4y"]
|
||||||
|
|
||||||
[ext_resource type="Theme" uid="uid://cmhwbyqu6nh38" path="res://assets/themes/big.tres" id="1_j1bkw"]
|
[ext_resource type="Theme" uid="uid://cmhwbyqu6nh38" path="res://assets/themes/big.tres" id="1_j1bkw"]
|
||||||
[ext_resource type="Script" path="res://scenes/reservation/reservation_creation.gd" id="1_whumk"]
|
[ext_resource type="Script" path="res://scenes/reservation/reservation_page.gd" id="1_prqr3"]
|
||||||
[ext_resource type="PackedScene" uid="uid://d0fdiesiaajlq" path="res://scenes/common/edit_field.tscn" id="2_qfs8j"]
|
[ext_resource type="PackedScene" uid="uid://d0fdiesiaajlq" path="res://scenes/common/edit_field.tscn" id="2_qfs8j"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dlqbv"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dlqbv"]
|
||||||
@ -13,16 +13,22 @@ bg_color = Color(0.6, 0.6, 0.6, 0)
|
|||||||
border_width_top = 3
|
border_width_top = 3
|
||||||
border_color = Color(0.8, 0.8, 0.8, 0.392157)
|
border_color = Color(0.8, 0.8, 0.8, 0.392157)
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_r7q2r"]
|
||||||
|
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||||
|
border_width_top = 3
|
||||||
|
border_color = Color(0.8, 0.8, 0.8, 0.392157)
|
||||||
|
|
||||||
[node name="ReservationCreation" type="VBoxContainer"]
|
[node name="ReservationCreation" type="VBoxContainer"]
|
||||||
anchors_preset = 10
|
anchors_preset = 10
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
offset_bottom = 23.0
|
offset_bottom = 23.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
theme_override_constants/separation = 35
|
theme_override_constants/separation = 35
|
||||||
script = ExtResource("1_whumk")
|
script = ExtResource("1_prqr3")
|
||||||
|
|
||||||
[node name="TopBar" type="HBoxContainer" parent="."]
|
[node name="TopBar" type="HBoxContainer" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 50
|
||||||
|
|
||||||
[node name="BackButton" type="Button" parent="TopBar"]
|
[node name="BackButton" type="Button" parent="TopBar"]
|
||||||
custom_minimum_size = Vector2(0, 100)
|
custom_minimum_size = Vector2(0, 100)
|
||||||
@ -61,9 +67,11 @@ layout_mode = 2
|
|||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_yafv8")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_yafv8")
|
||||||
|
|
||||||
[node name="DateField" parent="." instance=ExtResource("2_qfs8j")]
|
[node name="DateField" parent="." instance=ExtResource("2_qfs8j")]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
title = "Дата"
|
title = "Дата"
|
||||||
type = 2
|
type = 2
|
||||||
|
editable = false
|
||||||
|
|
||||||
[node name="StartTimeField" parent="." instance=ExtResource("2_qfs8j")]
|
[node name="StartTimeField" parent="." instance=ExtResource("2_qfs8j")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
@ -76,24 +84,50 @@ title = "Конец"
|
|||||||
type = 3
|
type = 3
|
||||||
|
|
||||||
[node name="Splitter3" type="Panel" parent="."]
|
[node name="Splitter3" type="Panel" parent="."]
|
||||||
|
visible = false
|
||||||
custom_minimum_size = Vector2(0, 5)
|
custom_minimum_size = Vector2(0, 5)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_yafv8")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_yafv8")
|
||||||
|
|
||||||
[node name="CreatorField" parent="." instance=ExtResource("2_qfs8j")]
|
[node name="CreatorField" parent="." instance=ExtResource("2_qfs8j")]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
title = "Создатель"
|
title = "Создатель"
|
||||||
|
editable = false
|
||||||
|
|
||||||
[node name="RoomField" parent="." instance=ExtResource("2_qfs8j")]
|
[node name="RoomField" parent="." instance=ExtResource("2_qfs8j")]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
title = "Комната"
|
title = "Комната"
|
||||||
|
editable = false
|
||||||
|
|
||||||
[node name="Splitter4" type="Panel" parent="."]
|
[node name="Splitter4" type="Panel" parent="."]
|
||||||
|
visible = false
|
||||||
custom_minimum_size = Vector2(0, 5)
|
custom_minimum_size = Vector2(0, 5)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_yafv8")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_yafv8")
|
||||||
|
|
||||||
[node name="DescriptionField" parent="." instance=ExtResource("2_qfs8j")]
|
[node name="DescriptionField" parent="." instance=ExtResource("2_qfs8j")]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
title = "Описание"
|
title = "Описание"
|
||||||
type = 1
|
type = 1
|
||||||
|
editable = false
|
||||||
|
|
||||||
|
[node name="Splitter5" type="Panel" parent="."]
|
||||||
|
visible = false
|
||||||
|
custom_minimum_size = Vector2(0, 5)
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_r7q2r")
|
||||||
|
|
||||||
|
[node name="BottomBar" type="BoxContainer" parent="."]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
alignment = 2
|
||||||
|
|
||||||
|
[node name="DeleteButton" type="Button" parent="BottomBar"]
|
||||||
|
custom_minimum_size = Vector2(0, 100)
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("1_j1bkw")
|
||||||
|
text = "Удалить"
|
||||||
|
alignment = 2
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
[gd_scene load_steps=2 format=3 uid="uid://dcwvxdme8mjsq"]
|
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://csfn8q6b5hj4y" path="res://scenes/reservation/reservation_creation.tscn" id="1_yk1ll"]
|
|
||||||
|
|
||||||
[node name="ReservationCreation" type="Control"]
|
|
||||||
layout_mode = 3
|
|
||||||
anchor_left = 0.02
|
|
||||||
anchor_top = 0.01
|
|
||||||
anchor_right = 0.98
|
|
||||||
anchor_bottom = 0.99
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
|
|
||||||
[node name="BackgroundColor" type="ColorRect" parent="."]
|
|
||||||
layout_mode = 1
|
|
||||||
anchors_preset = 15
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
color = Color(0.133333, 0.14902, 0.176471, 1)
|
|
||||||
|
|
||||||
[node name="VerticalBar" parent="." instance=ExtResource("1_yk1ll")]
|
|
||||||
layout_mode = 0
|
|
||||||
anchors_preset = 0
|
|
||||||
anchor_right = 0.0
|
|
||||||
grow_horizontal = 1
|
|
127
scenes/reservation/reservation_edit.tscn
Normal file
127
scenes/reservation/reservation_edit.tscn
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
[gd_scene load_steps=6 format=3 uid="uid://cu6e3hfdorwcg"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/reservation/reservation_page.gd" id="1_81iob"]
|
||||||
|
[ext_resource type="Theme" uid="uid://cmhwbyqu6nh38" path="res://assets/themes/big.tres" id="2_57fpn"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://d0fdiesiaajlq" path="res://scenes/common/edit_field.tscn" id="3_lh5s8"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dlqbv"]
|
||||||
|
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||||
|
border_width_top = 5
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yafv8"]
|
||||||
|
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||||
|
border_width_top = 3
|
||||||
|
border_color = Color(0.8, 0.8, 0.8, 0.392157)
|
||||||
|
|
||||||
|
[node name="ReservationEdit" type="VBoxContainer"]
|
||||||
|
custom_minimum_size = Vector2(1000, 0)
|
||||||
|
anchors_preset = 10
|
||||||
|
anchor_right = 1.0
|
||||||
|
offset_bottom = 23.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
theme_override_constants/separation = 35
|
||||||
|
script = ExtResource("1_81iob")
|
||||||
|
type = 1
|
||||||
|
|
||||||
|
[node name="TopBar" type="HBoxContainer" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 50
|
||||||
|
|
||||||
|
[node name="BackButton" type="Button" parent="TopBar"]
|
||||||
|
custom_minimum_size = Vector2(0, 100)
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("2_57fpn")
|
||||||
|
text = "Назад"
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="TopBar"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 6
|
||||||
|
theme = ExtResource("2_57fpn")
|
||||||
|
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
|
||||||
|
theme_override_constants/shadow_offset_x = 3
|
||||||
|
theme_override_constants/shadow_offset_y = 3
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="ApplyButton" type="Button" parent="TopBar"]
|
||||||
|
custom_minimum_size = Vector2(0, 100)
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("2_57fpn")
|
||||||
|
text = "Изменить"
|
||||||
|
|
||||||
|
[node name="Splitter" type="Panel" parent="."]
|
||||||
|
custom_minimum_size = Vector2(0, 15)
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_dlqbv")
|
||||||
|
|
||||||
|
[node name="TitleField" parent="." instance=ExtResource("3_lh5s8")]
|
||||||
|
layout_mode = 2
|
||||||
|
title = "Название"
|
||||||
|
|
||||||
|
[node name="Splitter2" type="Panel" parent="."]
|
||||||
|
custom_minimum_size = Vector2(0, 5)
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_yafv8")
|
||||||
|
|
||||||
|
[node name="DateField" parent="." instance=ExtResource("3_lh5s8")]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
title = "Дата"
|
||||||
|
type = 2
|
||||||
|
editable = false
|
||||||
|
|
||||||
|
[node name="StartTimeField" parent="." instance=ExtResource("3_lh5s8")]
|
||||||
|
layout_mode = 2
|
||||||
|
title = "Начало"
|
||||||
|
type = 3
|
||||||
|
|
||||||
|
[node name="FinishTimeField" parent="." instance=ExtResource("3_lh5s8")]
|
||||||
|
layout_mode = 2
|
||||||
|
title = "Конец"
|
||||||
|
type = 3
|
||||||
|
|
||||||
|
[node name="Splitter3" type="Panel" parent="."]
|
||||||
|
visible = false
|
||||||
|
custom_minimum_size = Vector2(0, 5)
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_yafv8")
|
||||||
|
|
||||||
|
[node name="CreatorField" parent="." instance=ExtResource("3_lh5s8")]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
title = "Создатель"
|
||||||
|
editable = false
|
||||||
|
|
||||||
|
[node name="RoomField" parent="." instance=ExtResource("3_lh5s8")]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
title = "Комната"
|
||||||
|
editable = false
|
||||||
|
|
||||||
|
[node name="Splitter4" type="Panel" parent="."]
|
||||||
|
visible = false
|
||||||
|
custom_minimum_size = Vector2(0, 5)
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_yafv8")
|
||||||
|
|
||||||
|
[node name="DescriptionField" parent="." instance=ExtResource("3_lh5s8")]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
title = "Описание"
|
||||||
|
type = 1
|
||||||
|
editable = false
|
||||||
|
|
||||||
|
[node name="Splitter5" type="Panel" parent="."]
|
||||||
|
custom_minimum_size = Vector2(0, 5)
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_yafv8")
|
||||||
|
|
||||||
|
[node name="BottomBar" type="BoxContainer" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
alignment = 2
|
||||||
|
|
||||||
|
[node name="DeleteButton" type="Button" parent="BottomBar"]
|
||||||
|
custom_minimum_size = Vector2(0, 100)
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("2_57fpn")
|
||||||
|
text = "Удалить"
|
||||||
|
alignment = 2
|
@ -1,8 +1,19 @@
|
|||||||
extends VBoxContainer
|
extends VBoxContainer
|
||||||
|
|
||||||
|
enum Types {
|
||||||
|
Creation,
|
||||||
|
Edit,
|
||||||
|
Info
|
||||||
|
}
|
||||||
|
|
||||||
|
@export var type : Types:
|
||||||
|
set(new_type):
|
||||||
|
type = new_type
|
||||||
|
|
||||||
@onready var _main: Main = get_tree().get_current_scene()
|
@onready var _main: Main = get_tree().get_current_scene()
|
||||||
@onready var _back_button := $TopBar/BackButton
|
@onready var _back_button := $TopBar/BackButton
|
||||||
@onready var _apply_button := $TopBar/ApplyButton
|
@onready var _apply_button := $TopBar/ApplyButton
|
||||||
|
@onready var _delete_button := $BottomBar/DeleteButton
|
||||||
|
|
||||||
@onready var _title_field := $TitleField
|
@onready var _title_field := $TitleField
|
||||||
@onready var _date_field := $DateField
|
@onready var _date_field := $DateField
|
||||||
@ -19,11 +30,30 @@ func initialize_signals():
|
|||||||
_back_button.pressed.connect(_on_back_button_pressed)
|
_back_button.pressed.connect(_on_back_button_pressed)
|
||||||
_apply_button.pressed.connect(_on_apply_button_pressed)
|
_apply_button.pressed.connect(_on_apply_button_pressed)
|
||||||
|
|
||||||
|
if type == Types.Edit:
|
||||||
|
_delete_button.pressed.connect(_on_delete_button_pressed)
|
||||||
|
|
||||||
func _on_back_button_pressed():
|
func _on_back_button_pressed():
|
||||||
_main.load_page(Main.Pages.Board)
|
_main.load_page(Main.Pages.Board)
|
||||||
|
|
||||||
func _on_apply_button_pressed():
|
func _on_apply_button_pressed():
|
||||||
|
match type:
|
||||||
|
Types.Creation:
|
||||||
_create_reservation()
|
_create_reservation()
|
||||||
|
Types.Edit:
|
||||||
|
_update_reservation()
|
||||||
|
|
||||||
|
func _on_delete_button_pressed():
|
||||||
|
_delete_reservation()
|
||||||
|
|
||||||
|
func _load_info():
|
||||||
|
var repo = _main.get_reservation_repo()
|
||||||
|
var reservation_id = repo.get_current_reservation_id()
|
||||||
|
var reservation = repo.get_reservation(reservation_id)
|
||||||
|
|
||||||
|
_title_field.set_value(reservation.title)
|
||||||
|
_start_time_field.set_value(reservation.start_time)
|
||||||
|
_finish_time_field.set_value(reservation.finish_time)
|
||||||
|
|
||||||
func _create_reservation():
|
func _create_reservation():
|
||||||
if not _fields_are_correct():
|
if not _fields_are_correct():
|
||||||
@ -47,6 +77,38 @@ func _create_reservation():
|
|||||||
_main.load_page(Main.Pages.Board)
|
_main.load_page(Main.Pages.Board)
|
||||||
clean()
|
clean()
|
||||||
|
|
||||||
|
func _update_reservation():
|
||||||
|
if not _fields_are_correct():
|
||||||
|
return
|
||||||
|
|
||||||
|
var dto = UpdateReservationDTO.new()
|
||||||
|
dto.title = _title_field.get_value()
|
||||||
|
dto.date = _date_field.get_value()
|
||||||
|
dto.start_time = _start_time_field.get_value()
|
||||||
|
dto.finish_time = _finish_time_field.get_value()
|
||||||
|
dto.creator = _creator_field.get_value()
|
||||||
|
dto.room_id = _room_field.get_value() # TODO: make it listbox
|
||||||
|
dto.description = _description_field.get_value()
|
||||||
|
dto.color = randi_range(1, 3)
|
||||||
|
|
||||||
|
var repo = _main.get_reservation_repo()
|
||||||
|
var reservation_id = repo.get_current_reservation_id()
|
||||||
|
repo.change_reservation(reservation_id, dto)
|
||||||
|
repo.set_current_reservation_id(null)
|
||||||
|
|
||||||
|
dto.queue_free()
|
||||||
|
|
||||||
|
_main.load_page(Main.Pages.Board)
|
||||||
|
clean()
|
||||||
|
|
||||||
|
func _delete_reservation():
|
||||||
|
var repo = _main.get_reservation_repo()
|
||||||
|
var reservation_id = repo.get_current_reservation_id()
|
||||||
|
repo.cancel_reservation(reservation_id)
|
||||||
|
|
||||||
|
_main.load_page(Main.Pages.Board)
|
||||||
|
clean()
|
||||||
|
|
||||||
func _fields_are_correct():
|
func _fields_are_correct():
|
||||||
var successful := true
|
var successful := true
|
||||||
|
|
||||||
@ -74,11 +136,15 @@ func _time_is_correct():
|
|||||||
|
|
||||||
var repo = _main.get_reservation_repo()
|
var repo = _main.get_reservation_repo()
|
||||||
var reservations = repo.list_reservations()
|
var reservations = repo.list_reservations()
|
||||||
|
var current_reservation_id = repo.get_current_reservation_id()
|
||||||
|
|
||||||
var new_start_time_minutes = start_time["hours"]*60 + start_time["minutes"]
|
var new_start_time_minutes = start_time["hours"]*60 + start_time["minutes"]
|
||||||
var new_finish_time_minutes = finish_time["hours"]*60 + finish_time["minutes"]
|
var new_finish_time_minutes = finish_time["hours"]*60 + finish_time["minutes"]
|
||||||
|
|
||||||
for reservation in reservations:
|
for reservation in reservations:
|
||||||
|
if reservation.id == current_reservation_id:
|
||||||
|
continue
|
||||||
|
|
||||||
var other_start_time = reservation.start_time
|
var other_start_time = reservation.start_time
|
||||||
var other_finish_time = reservation.finish_time
|
var other_finish_time = reservation.finish_time
|
||||||
var other_start_time_minutes = other_start_time["hours"]*60 + other_start_time["minutes"]
|
var other_start_time_minutes = other_start_time["hours"]*60 + other_start_time["minutes"]
|
||||||
@ -106,9 +172,15 @@ func _time_is_correct():
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
func set_start_time(value):
|
||||||
|
_start_time_field.set_value(value)
|
||||||
|
|
||||||
func update():
|
func update():
|
||||||
_ready()
|
_ready()
|
||||||
|
|
||||||
|
if type == Types.Edit:
|
||||||
|
_load_info()
|
||||||
|
|
||||||
func clean():
|
func clean():
|
||||||
_title_field.clean()
|
_title_field.clean()
|
||||||
_start_time_field.clean()
|
_start_time_field.clean()
|
@ -1,7 +1,8 @@
|
|||||||
|
@tool
|
||||||
extends Node
|
extends Node
|
||||||
class_name AbstractReservationRepo
|
class_name AbstractReservationRepo
|
||||||
|
|
||||||
var _current_reservation = null
|
var _current_reservation_id = null
|
||||||
|
|
||||||
func create_reservation(dto: CreateReservationDTO):
|
func create_reservation(dto: CreateReservationDTO):
|
||||||
pass
|
pass
|
||||||
@ -18,8 +19,8 @@ func get_reservation(reservation_id):
|
|||||||
func list_reservations():
|
func list_reservations():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func set_current_reservation(value):
|
func set_current_reservation_id(value):
|
||||||
_current_reservation = value
|
_current_reservation_id = value
|
||||||
|
|
||||||
func get_current_reservation(value):
|
func get_current_reservation_id():
|
||||||
return _current_reservation
|
return _current_reservation_id
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
@tool
|
||||||
extends AbstractReservationRepo
|
extends AbstractReservationRepo
|
||||||
class_name LocalReservationRepo
|
class_name LocalReservationRepo
|
||||||
|
|
||||||
@ -31,8 +32,8 @@ func change_reservation(reservation_id, dto: UpdateReservationDTO):
|
|||||||
entity.description = dto.description
|
entity.description = dto.description
|
||||||
entity.room_id = dto.room_id
|
entity.room_id = dto.room_id
|
||||||
entity.creator = dto.creator
|
entity.creator = dto.creator
|
||||||
entity.start_date = dto.start_date.duplicate(true)
|
entity.start_time = dto.start_time.duplicate(true)
|
||||||
entity.finish_date = dto.finish_date.duplicate(true)
|
entity.finish_time = dto.finish_time.duplicate(true)
|
||||||
|
|
||||||
func get_reservation(reservation_id):
|
func get_reservation(reservation_id):
|
||||||
return _reservations[reservation_id]
|
return _reservations[reservation_id]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user