podbooker now secure in editing a booking

This commit is contained in:
Jaap Marsman 2023-05-16 19:03:41 +08:00
parent b4b522c407
commit 8226196361
3 changed files with 28 additions and 5 deletions

View File

@ -76,3 +76,15 @@ func _on_ClearButton_pressed():
_clear_form() _clear_form()
_book_it() _book_it()
_on_CancelButton_pressed() _on_CancelButton_pressed()
func _on_change_button_pressed():
if $"%BookPw".text == "WhoIsJaap":
if name1.text == "" or reason.text =="":
err_label.visible = true
else:
var namer = "/root/MainStartScreen/ButtonGrid/" + important_vars.pod + "L" + str(important_vars.time)
var sp = get_node(str(namer))
sp.text = "BOOKED"
_book_it()
_on_CancelButton_pressed()

View File

@ -56,10 +56,10 @@ func set_booking_screen_values():
day_name.text = "Today is " + times.dayofweek_word day_name.text = "Today is " + times.dayofweek_word
topbar_color() topbar_color()
booking_vars.read_values() booking_vars.read_values()
if name1.text != "": # if name1.text != "":
book_button.text = "Save Changed Booking" # book_button.text = "Save Changed Booking"
else: # else:
book_button.text = "Book" # book_button.text = "Book"
func drop_names_to_two(): func drop_names_to_two():
@ -107,12 +107,16 @@ func book_button_pressed(pod_name, lesson):
# settings_button.visible = false # settings_button.visible = false
if name1.text != "": if name1.text != "":
clear_button.visible = true clear_button.visible = true
$"%ChangeButton".visible = true
$"%ClearBookPw".visible = true $"%ClearBookPw".visible = true
$"%BookPw".visible = true $"%BookPw".visible = true
$"%BookButton".visible = false
if name1.text == "": if name1.text == "":
clear_button.visible = false clear_button.visible = false
$"%ChangeButton".visible = false
$"%ClearBookPw".visible = false $"%ClearBookPw".visible = false
$"%BookPw".visible = false $"%BookPw".visible = false
$"%BookButton".visible = true
func _on_A1L1_pressed(): func _on_A1L1_pressed():
book_button_pressed("A1", 1) book_button_pressed("A1", 1)

View File

@ -1483,6 +1483,12 @@ layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
text = "Book" text = "Book"
[node name="ChangeButton" type="Button" parent="BookingScreen/Buttons"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "Change Booking"
[node name="ClearButton" type="Button" parent="BookingScreen/Buttons"] [node name="ClearButton" type="Button" parent="BookingScreen/Buttons"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
@ -1500,7 +1506,7 @@ unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
theme_override_colors/font_color = Color(0, 0, 0, 1) theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "Clear Booking Password:" text = "Clear / Change Password:"
[node name="BookPw" type="LineEdit" parent="BookingScreen/PwArea"] [node name="BookPw" type="LineEdit" parent="BookingScreen/PwArea"]
unique_name_in_owner = true unique_name_in_owner = true
@ -1724,6 +1730,7 @@ script = ExtResource("11")
[connection signal="pressed" from="SettingsButton" to="." method="_on_SettingsButton_pressed"] [connection signal="pressed" from="SettingsButton" to="." method="_on_SettingsButton_pressed"]
[connection signal="pressed" from="BookingScreen/Buttons/CancelButton" to="BookingScreen" method="_on_CancelButton_pressed"] [connection signal="pressed" from="BookingScreen/Buttons/CancelButton" to="BookingScreen" method="_on_CancelButton_pressed"]
[connection signal="pressed" from="BookingScreen/Buttons/BookButton" to="BookingScreen" method="_on_BookButton_pressed"] [connection signal="pressed" from="BookingScreen/Buttons/BookButton" to="BookingScreen" method="_on_BookButton_pressed"]
[connection signal="pressed" from="BookingScreen/Buttons/ChangeButton" to="BookingScreen" method="_on_change_button_pressed"]
[connection signal="pressed" from="BookingScreen/Buttons/ClearButton" to="BookingScreen" method="_on_ClearButton_pressed"] [connection signal="pressed" from="BookingScreen/Buttons/ClearButton" to="BookingScreen" method="_on_ClearButton_pressed"]
[connection signal="pressed" from="ResetMenu/ResetButton" to="ResetMenu" method="_on_ResetButton_pressed"] [connection signal="pressed" from="ResetMenu/ResetButton" to="ResetMenu" method="_on_ResetButton_pressed"]
[connection signal="pressed" from="ResetMenu/CancelReset" to="ResetMenu" method="_on_CancelReset_pressed"] [connection signal="pressed" from="ResetMenu/CancelReset" to="ResetMenu" method="_on_CancelReset_pressed"]