{"id":2769,"date":"2025-10-08T10:51:07","date_gmt":"2025-10-08T08:51:07","guid":{"rendered":"https:\/\/apartamentgdyniababiedoly.pl\/?page_id=2769"},"modified":"2025-10-08T11:19:51","modified_gmt":"2025-10-08T09:19:51","slug":"portal-klienta-apartament-gdynia-babie-doly","status":"publish","type":"page","link":"https:\/\/apartamentgdyniababiedoly.pl\/?page_id=2769","title":{"rendered":"Portal Klienta Apartament Gdynia Babie Do\u0142y"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"2769\" class=\"elementor elementor-2769\">\n\t\t\t\t<div class=\"elementor-element elementor-element-2e869e4 e-flex e-con-boxed e-con e-parent\" data-id=\"2e869e4\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-331478d elementor-widget elementor-widget-html\" data-id=\"331478d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<!DOCTYPE html>\r\n<html lang=\"pl\">\r\n<head>\r\n<meta charset=\"UTF-8\">\r\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n<title>Panel Go\u015bcia Apartamentu<\/title>\r\n<style>\r\n  body { font-family: 'Segoe UI', sans-serif; background: #f3f6fa; margin:0; padding:0; }\r\n  .app { max-width:500px; margin:40px auto; background:#fff; border-radius:20px;\r\n         box-shadow:0 4px 20px rgba(0,0,0,0.1); padding:25px; }\r\n  h2 { text-align:center; color:#1a1a1a; margin-bottom:20px; }\r\n  input, textarea { width:100%; padding:10px; border-radius:10px; border:1px solid #ccc;\r\n                    margin-top:8px; margin-bottom:12px; font-size:15px; }\r\n  button { width:100%; padding:12px; border:none; border-radius:10px;\r\n           background-color:#0077cc; color:white; font-size:16px; cursor:pointer; }\r\n  button:hover { background-color:#005fa3; }\r\n  .hidden { display:none; }\r\n  .logout-btn { margin-top:15px; background:#444; }\r\n  iframe { width:100%; height:220px; border:0; border-radius:10px; }\r\n<\/style>\r\n<\/head>\r\n<body>\r\n\r\n<div class=\"app\">\r\n  <!-- Logowanie -->\r\n  <div id=\"loginScreen\">\r\n    <h2>Panel logowania<\/h2>\r\n    <input type=\"text\" id=\"loginUser\" placeholder=\"Login\">\r\n    <input type=\"password\" id=\"loginPass\" placeholder=\"Has\u0142o\">\r\n    <button onclick=\"login()\">Zaloguj<\/button>\r\n    <p id=\"loginError\" style=\"color:red; text-align:center;\"><\/p>\r\n  <\/div>\r\n\r\n  <!-- Panel Go\u015bcia -->\r\n  <div id=\"guestPanel\" class=\"hidden\">\r\n    <h2>Witaj, <span id=\"guestName\"><\/span>!<\/h2>\r\n    <p><strong>\ud83d\udccd Adres:<\/strong> <span id=\"address\"><\/span><\/p>\r\n    <p><strong>\ud83d\udd11 Kod do mieszkania:<\/strong> <span id=\"apartmentCode\"><\/span><\/p>\r\n    <p><strong>\u260e\ufe0f Kod do domofonu:<\/strong> <span id=\"intercomCode\"><\/span><\/p>\r\n    <p><strong>\ud83d\udedc Wi-Fi:<\/strong> <span id=\"wifi\"><\/span><\/p>\r\n    <p><strong>\ud83c\udd7f\ufe0f Parking:<\/strong> <span id=\"parking\"><\/span><\/p>\r\n    <p><strong>\ud83d\udcd6 Instrukcja zameldowania:<\/strong><\/p>\r\n    <p id=\"instructions\"><\/p>\r\n    <p><strong>\ud83d\udcde Kontakt:<\/strong> <a id=\"contactHost\" target=\"_blank\"><\/a><\/p>\r\n    <iframe id=\"map\"><\/iframe>\r\n    <button class=\"logout-btn\" onclick=\"logout()\">Wyloguj<\/button>\r\n  <\/div>\r\n\r\n  <!-- Panel Administratora -->\r\n  <div id=\"adminPanel\" class=\"hidden\">\r\n    <h2>Panel Administratora<\/h2>\r\n    <input id=\"guestLogin\" placeholder=\"Login go\u015bcia\">\r\n    <input id=\"guestPass\" placeholder=\"Has\u0142o go\u015bcia\">\r\n    <input id=\"guestNameInput\" placeholder=\"Imi\u0119 i nazwisko go\u015bcia\">\r\n    <textarea id=\"guestAddress\" placeholder=\"Adres apartamentu\"><\/textarea>\r\n    <input id=\"guestApartmentCode\" placeholder=\"Kod do mieszkania\">\r\n    <input id=\"guestIntercomCode\" placeholder=\"Kod do domofonu\">\r\n    <input id=\"guestWifi\" placeholder=\"Dane Wi-Fi\">\r\n    <input id=\"guestParking\" placeholder=\"Parking\">\r\n    <textarea id=\"guestInstructions\" placeholder=\"Instrukcje zameldowania\"><\/textarea>\r\n    <input id=\"guestMap\" placeholder=\"Link do mapy (Google Maps embed)\">\r\n    <input id=\"guestContact\" placeholder=\"Kontakt (tel:\/WhatsApp)\">\r\n    <button onclick=\"saveGuest()\">\ud83d\udcbe Zapisz \/ Zaktualizuj<\/button>\r\n    <button onclick=\"deleteGuest()\">\ud83d\uddd1\ufe0f Usu\u0144 go\u015bcia<\/button>\r\n    <button onclick=\"listGuests()\">\ud83d\udccb Lista go\u015bci<\/button>\r\n    <button class=\"logout-btn\" onclick=\"logout()\">Wyloguj<\/button>\r\n    <div id=\"guestList\" style=\"margin-top:20px;\"><\/div>\r\n  <\/div>\r\n<\/div>\r\n\r\n<script>\r\nconst adminLogin = \"admin\";\r\nconst adminPass = \"apart2025\";\r\n\r\n\/\/ Automatyczne logowanie po tokenie w URL\r\nwindow.addEventListener(\"DOMContentLoaded\", async () => {\r\n  const urlParams = new URLSearchParams(window.location.search);\r\n  const token = urlParams.get(\"token\");\r\n  if (token) {\r\n    const res = await fetch(\"backend.php?action=getByToken&token=\" + encodeURIComponent(token));\r\n    const data = await res.json();\r\n    if (data && data.name) {\r\n      showGuestPanel(data);\r\n    }\r\n  }\r\n});\r\n\r\nasync function login() {\r\n  const u = loginUser.value.trim();\r\n  const p = loginPass.value.trim();\r\n  const err = loginError;\r\n\r\n  if (u === adminLogin && p === adminPass) {\r\n    showAdminPanel();\r\n    return;\r\n  }\r\n\r\n  const res = await fetch(\"backend.php?action=get&login=\" + encodeURIComponent(u));\r\n  const data = await res.json();\r\n\r\n  if (data && data.password === p) {\r\n    showGuestPanel(data);\r\n  } else {\r\n    err.textContent = \"Nieprawid\u0142owy login lub has\u0142o.\";\r\n  }\r\n}\r\n\r\nfunction showGuestPanel(c) {\r\n  loginScreen.classList.add(\"hidden\");\r\n  guestPanel.classList.remove(\"hidden\");\r\n  guestName.textContent = c.name;\r\n  address.textContent = c.address;\r\n  apartmentCode.textContent = c.apartmentCode;\r\n  intercomCode.textContent = c.intercomCode;\r\n  wifi.textContent = c.wifi;\r\n  parking.textContent = c.parking;\r\n  instructions.textContent = c.instructions;\r\n  contactHost.href = c.contact;\r\n  contactHost.textContent = c.contact;\r\n  map.src = c.map;\r\n}\r\n\r\nfunction logout() {\r\n  guestPanel.classList.add(\"hidden\");\r\n  adminPanel.classList.add(\"hidden\");\r\n  loginScreen.classList.remove(\"hidden\");\r\n  loginUser.value = \"\";\r\n  loginPass.value = \"\";\r\n}\r\n\r\nfunction showAdminPanel() {\r\n  loginScreen.classList.add(\"hidden\");\r\n  adminPanel.classList.remove(\"hidden\");\r\n}\r\n\r\nasync function saveGuest() {\r\n  const guest = {\r\n    login: guestLogin.value,\r\n    password: guestPass.value,\r\n    name: guestNameInput.value,\r\n    address: guestAddress.value,\r\n    apartmentCode: guestApartmentCode.value,\r\n    intercomCode: guestIntercomCode.value,\r\n    wifi: guestWifi.value,\r\n    parking: guestParking.value,\r\n    instructions: guestInstructions.value,\r\n    map: guestMap.value,\r\n    contact: guestContact.value\r\n  };\r\n  const res = await fetch(\"backend.php?action=save\", {\r\n    method: \"POST\",\r\n    headers: { \"Content-Type\": \"application\/json\" },\r\n    body: JSON.stringify(guest)\r\n  });\r\n  alert(await res.text());\r\n}\r\n\r\nasync function deleteGuest() {\r\n  const login = guestLogin.value;\r\n  if (!login) return alert(\"Podaj login go\u015bcia.\");\r\n  const res = await fetch(\"backend.php?action=delete&login=\" + encodeURIComponent(login));\r\n  alert(await res.text());\r\n}\r\n\r\nasync function listGuests() {\r\n  const res = await fetch(\"backend.php?action=list\");\r\n  const data = await res.json();\r\n  guestList.innerHTML = \"<h4>Lista go\u015bci:<\/h4>\" + \r\n    Object.keys(data).map(k => `<p><strong>${k}<\/strong> \u2013 ${data[k].name}<br><small>Token: ${data[k].token || '-'}<\/small><\/p>`).join(\"\");\r\n}\r\n<\/script>\r\n<\/body>\r\n<\/html>\r\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Panel Go\u015bcia Apartamentu Panel logowania Zaloguj Witaj, ! \ud83d\udccd Adres: \ud83d\udd11 Kod do mieszkania: \u260e\ufe0f Kod do domofonu: \ud83d\udedc Wi-Fi: \ud83c\udd7f\ufe0f Parking: \ud83d\udcd6 Instrukcja zameldowania: \ud83d\udcde Kontakt: Wyloguj Panel Administratora \ud83d\udcbe Zapisz \/ Zaktualizuj \ud83d\uddd1\ufe0f Usu\u0144 go\u015bcia \ud83d\udccb Lista go\u015bci Wyloguj<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","footnotes":""},"class_list":["post-2769","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/apartamentgdyniababiedoly.pl\/index.php?rest_route=\/wp\/v2\/pages\/2769","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/apartamentgdyniababiedoly.pl\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/apartamentgdyniababiedoly.pl\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/apartamentgdyniababiedoly.pl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/apartamentgdyniababiedoly.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2769"}],"version-history":[{"count":13,"href":"https:\/\/apartamentgdyniababiedoly.pl\/index.php?rest_route=\/wp\/v2\/pages\/2769\/revisions"}],"predecessor-version":[{"id":2782,"href":"https:\/\/apartamentgdyniababiedoly.pl\/index.php?rest_route=\/wp\/v2\/pages\/2769\/revisions\/2782"}],"wp:attachment":[{"href":"https:\/\/apartamentgdyniababiedoly.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2769"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}