wbs wbw fix
This commit is contained in:
parent
0d1de13420
commit
856f683ec3
1 changed files with 46 additions and 38 deletions
|
|
@ -231,6 +231,7 @@ class GewobagHandler(BaseHandler):
|
||||||
logger.warning(f"[GEWOBAG] Could not fill Mobilfunknummer: {e}")
|
logger.warning(f"[GEWOBAG] Could not fill Mobilfunknummer: {e}")
|
||||||
|
|
||||||
# WBS (Wohnberechtigungsschein) - Handle both regular and special needs WBS
|
# WBS (Wohnberechtigungsschein) - Handle both regular and special needs WBS
|
||||||
|
wbs_fields_should_be_filled = False
|
||||||
try:
|
try:
|
||||||
# Check for regular WBS first (click Ja)
|
# Check for regular WBS first (click Ja)
|
||||||
wbs_ja = await iframe_page.query_selector('input[type="radio"][id*="wbs_available"][id*="-Ja"]')
|
wbs_ja = await iframe_page.query_selector('input[type="radio"][id*="wbs_available"][id*="-Ja"]')
|
||||||
|
|
@ -250,6 +251,7 @@ class GewobagHandler(BaseHandler):
|
||||||
logger.warning(f"[GEWOBAG] Could not save WBS debug HTML: {e}")
|
logger.warning(f"[GEWOBAG] Could not save WBS debug HTML: {e}")
|
||||||
|
|
||||||
form_filled = True
|
form_filled = True
|
||||||
|
wbs_fields_should_be_filled = True # Only fill WBS fields if we selected Ja
|
||||||
|
|
||||||
# Check for special needs WBS (click Nein - we don't have this)
|
# Check for special needs WBS (click Nein - we don't have this)
|
||||||
wbs_special_nein = await iframe_page.query_selector('input[type="radio"][id*="wbs_mit_besonderem_wohnbedarf"][id*="-Nein"]')
|
wbs_special_nein = await iframe_page.query_selector('input[type="radio"][id*="wbs_mit_besonderem_wohnbedarf"][id*="-Nein"]')
|
||||||
|
|
@ -257,8 +259,12 @@ class GewobagHandler(BaseHandler):
|
||||||
await wbs_special_nein.click()
|
await wbs_special_nein.click()
|
||||||
logger.info("[GEWOBAG] Selected WBS mit besonderem Wohnbedarf: Nein")
|
logger.info("[GEWOBAG] Selected WBS mit besonderem Wohnbedarf: Nein")
|
||||||
form_filled = True
|
form_filled = True
|
||||||
|
# Don't fill WBS fields when we select Nein for special WBS
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"[GEWOBAG] Could not select WBS: {e}") # WBS Gültigkeit (validity date) - appears after selecting Ja
|
logger.warning(f"[GEWOBAG] Could not select WBS: {e}")
|
||||||
|
|
||||||
|
# WBS Gültigkeit (validity date) - only fill if regular WBS was selected
|
||||||
|
if wbs_fields_should_be_filled:
|
||||||
try:
|
try:
|
||||||
wbs_valid_until = os.environ.get("FORM_WBS_VALID_UNTIL", "26.11.2026")
|
wbs_valid_until = os.environ.get("FORM_WBS_VALID_UNTIL", "26.11.2026")
|
||||||
wbs_date_input = await iframe_page.query_selector('#formly_6_input_\\$\\$_wbs_valid_until_\\$\\$_0')
|
wbs_date_input = await iframe_page.query_selector('#formly_6_input_\\$\\$_wbs_valid_until_\\$\\$_0')
|
||||||
|
|
@ -269,7 +275,8 @@ class GewobagHandler(BaseHandler):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"[GEWOBAG] Could not fill WBS Gültigkeit: {e}")
|
logger.warning(f"[GEWOBAG] Could not fill WBS Gültigkeit: {e}")
|
||||||
|
|
||||||
# WBS Art/Bezeichnung (type) dropdown - appears after selecting Ja
|
# WBS Art/Bezeichnung (type) dropdown - only fill if regular WBS was selected
|
||||||
|
if wbs_fields_should_be_filled:
|
||||||
try:
|
try:
|
||||||
wbs_type = os.environ.get("FORM_WBS_TYPE", "WBS 100")
|
wbs_type = os.environ.get("FORM_WBS_TYPE", "WBS 100")
|
||||||
wbs_type_input = await iframe_page.query_selector('#formly_6_select_gewobag_art_bezeichnung_des_wbs_1')
|
wbs_type_input = await iframe_page.query_selector('#formly_6_select_gewobag_art_bezeichnung_des_wbs_1')
|
||||||
|
|
@ -284,7 +291,8 @@ class GewobagHandler(BaseHandler):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"[GEWOBAG] Could not select WBS Type: {e}")
|
logger.warning(f"[GEWOBAG] Could not select WBS Type: {e}")
|
||||||
|
|
||||||
# WBS Anzahl Räume (number of rooms) dropdown - appears after selecting Ja
|
# WBS Anzahl Räume (number of rooms) dropdown - only fill if regular WBS was selected
|
||||||
|
if wbs_fields_should_be_filled:
|
||||||
try:
|
try:
|
||||||
wbs_rooms = os.environ.get("FORM_WBS_ROOMS", "1")
|
wbs_rooms = os.environ.get("FORM_WBS_ROOMS", "1")
|
||||||
wbs_rooms_input = await iframe_page.query_selector('#formly_7_select_\\$\\$_wbs_max_number_rooms_\\$\\$_0')
|
wbs_rooms_input = await iframe_page.query_selector('#formly_7_select_\\$\\$_wbs_max_number_rooms_\\$\\$_0')
|
||||||
|
|
@ -299,7 +307,7 @@ class GewobagHandler(BaseHandler):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"[GEWOBAG] Could not select WBS Rooms: {e}")
|
logger.warning(f"[GEWOBAG] Could not select WBS Rooms: {e}")
|
||||||
|
|
||||||
# WBS file upload - Upload the WBS PDF and PNG from data/uploads
|
# WBS file upload - Upload the WBS PDF and PNG from data/uploads (always upload regardless of WBS type)
|
||||||
try:
|
try:
|
||||||
wbs_files = [
|
wbs_files = [
|
||||||
Path("data/uploads/WBS_Antrag_Bestaetigung.pdf"),
|
Path("data/uploads/WBS_Antrag_Bestaetigung.pdf"),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue