GUESTHOUSE CARD ADMIN - INSTALL AND USE
=======================================

WHAT IT DOES
- You (or your client) fill in a form. The admin builds a unique guest page for that guesthouse.
- Each guesthouse gets its own address:  https://YOUR-DOMAIN/g/<guesthouse-name>/
- Add ?room=3 to the end of the address to make a card that greets "Room 3" (one NFC tag per room).

WHAT YOU NEED
- Web hosting with PHP 8.0 or newer (cPanel hosting is fine) and HTTPS.
- PHP extensions mbstring and gd (almost every host has them; gd is only for the banner picture).

INSTALL (about 10 minutes)
1. In cPanel, create a subdomain, e.g. stay.yourdomain.co.za (or use a folder). Make sure it has HTTPS.
2. Upload guesthouse-admin.zip into that subdomain's folder and Extract it. Move the extracted files so that
   the folders admin, book, form, inc, manage, data, g and templates sit directly in the subdomain folder.
3. Make sure the folders data (including data/bookings and data/rl) and g are writable (permission 755; use 775 if saving fails).
4. Open  https://stay.yourdomain.co.za/admin/  - the first visit asks you to choose an admin password (10+ characters).
5. Log in. Create a client by typing the guesthouse name and pressing Create.

DAY TO DAY
1. Press Create, then either fill in the form yourself or copy the "Client form" link and send it to the guesthouse.
2. When the client submits, the list shows "Client sent changes". Open it, check it, then press Save and publish.
3. The guest page address appears under Links. Test it on a phone.
4. Use "Room tag addresses" to make one address per room, then write each onto an NFC tag.
5. To change anything later, edit and press Save and publish again. The NFC tags never need rewriting.

SAFETY NOTES
- Clients can only edit their own draft. Nothing goes live until you press Save and publish.
- Folders data, inc and templates are blocked from the web by .htaccess. On NGINX hosting these rules are NOT
  applied; ask your host to deny access to those three folders.
- The Bookings manager link is a secret address: anyone with it can manage that guesthouse's bookings.
- Keep the admin password long. Log out on shared computers.
- Back up the data folder now and then (it holds every client's details, pictures and bookings).

LOCATION AND PHONE NUMBERS (so the information is right for every guesthouse)
- Everything local on the card (weather, map buttons, things to do, nearest hospital/pharmacy/police) is driven by
  the guesthouse's address and map coordinates.
- On the client's page, press "Find location and nearby numbers". It looks up the address (OpenStreetMap), saves the
  map coordinates, and suggests the nearest hospital, pharmacy, police station and takeaway phone numbers.
  These are suggestions: some places have no number on the map. PHONE EACH ONE TO CONFIRM before publishing.
  (Needs the server to reach nominatim.openstreetmap.org and overpass-api.de. It is for occasional use, one
  guesthouse at a time.)
- South African national numbers always show: 112 (cell phones), 10111 (police), 10177 (ambulance).
- Phone numbers are tidied (+27 82 123 4567 becomes 082 123 4567) and checked. You get a warning for sample numbers
  (like 082 123 4567), a landline used for WhatsApp, or numbers that are too short. A guest card cannot be published
  without a host WhatsApp number.

BREAKFAST MENU AND PRICES
- On the client's page, section 4 "Breakfast" is a table: Dish, Description, Price. Type in a box to change it.
  Clear a dish name (or press the x) to remove a dish. "+ Add a dish" adds another row.
- Type prices as plain numbers (85 or 85.50). The card shows them with the currency symbol from section 5b, as
  R85, R85.50 or R1 250. Words such as "Free" are shown as typed.
- Tick box "Show prices on the breakfast menu": untick it and the dishes show without prices; tick it to bring
  them back. Tick box "Breakfast is served" shows or hides the whole breakfast section.
- Changes go live when you press "Save and publish".

BOOKING SYSTEM (calendar and prices)
- On the client's page, section "5b. Booking": one room type per line:
    Room name | price per night | how many rooms of this type | max guests | short description
  Example:  Garden Room | R850 | 2 | 2 | Private patio
- Tick box "Booking system (calendar and prices)" in section 8 switches the calendar system on or off.
  Tick box "Book direct button" shows or hides the green Book direct button.
  If the booking system is off (or has no rooms) the Book direct button opens WhatsApp to the host,
  or your "Other booking link" if you fill one in.
- Guests pick a room, tap check-in and check-out dates on the calendar, see the total, and send a request.
  Prices are always worked out on the server, so guests cannot change them.
- Nothing is booked until the guesthouse confirms. The guesthouse gets the request on its "Bookings manager" page
  (and by email if you enter an email address; email uses the server's mail function, which some hosts limit).
- Bookings manager: each client has a secret link (shown on the client's page in the admin). The guesthouse can
  confirm or decline requests, cancel bookings, and block dates for bookings made elsewhere. Confirmed and blocked
  dates disappear from the guests' calendar straight away. Keep this link private.
- Rooms with several units (e.g. "2") stay bookable until all units are confirmed for the same night.
- There is no online payment. Add a note such as "Banking details are sent when we confirm" in the booking note.
- Room and price changes need "Save and publish" in the admin. Bookings and blocked dates update instantly.
- Guests can send up to 6 requests per hour from one connection (spam protection).

HOME-SCREEN ICON AND OFFLINE COPY (automatic on every published page)
- Every guesthouse page is a "web app": it has the guesthouse's own icon, name and colour.
- Set the icon on the form: upload a square logo, or leave it empty for a coloured icon with the name's initials.
  Pick the brand colour on the same form. The icon is made for you (no image editing needed).
- Guests see a "Keep this card on your phone" box at the top of the card:
  - Android (Chrome): one button, "Add to home screen".
  - iPhone (Safari): short steps, "Share" then "Add to Home Screen". (iPhones do not allow a button for this.)
  - Tick/untick it with the "Add to home screen banner" tick box.
- After the guest opens the card once, a copy is saved on their phone, so the card (menu, rules, numbers) opens
  without internet. Weather needs internet. The copy refreshes itself whenever you publish a change.
- A website cannot add itself to the home screen or save a contact silently. The guest must tap once. The card
  makes that one tap as easy as possible, and "Save the host's contact" saves the host's number and the card link.
- If the card is on the home screen, a room tag tap still shows the right room: the card remembers the last room.
- Icons are drawn with the DejaVu Sans Bold font (free licence, included as inc/font.ttf).

NFC TAGS (the "RFID" part)
- Use NFC tags (13.56 MHz). Normal 125 kHz RFID cards do not work with phones.
- Buy NTAG215 tags (504 bytes) for guesthouses. NTAG213 (144 bytes) is usually too small for Wi-Fi + web address.
- Write them with the free "NXP TagWriter" app (Android or iPhone), or any NFC writer app.
- Tag type A (all phones): one record: Link/URL = the guest page address (with ?room=N for a room tag).
- Tag type B (Android joins Wi-Fi): record 1 = Wi-Fi network (name, WPA2, password); record 2 = Link/URL.
  iPhones ignore the Wi-Fi record and still open the web address. Always test on one Android phone and one iPhone.
- Tip: lock (make read-only) the tag after you test it, so guests cannot overwrite it.
- Tip: if Wi-Fi + link does not work on a guest's phone model, use two tags (a Wi-Fi tag and a card tag) or a printed
  Wi-Fi QR code beside the tag. The card also shows the Wi-Fi name and password with a Copy button.
- Use a guest Wi-Fi network, not the private one: the password can be read from the tag.

UPDATING THE CARD DESIGN LATER
- Replace templates/card-template.html with a newer version, then press "Rebuild all published pages".
