# Talisay Pickle Park Mobile-first court booking and operations app built with PHP, HTML, CSS, vanilla JavaScript, and MySQL. Designed to run on Hostinger and later be packaged for Android distribution through a Trusted Web Activity (TWA). ## Current starter features ### Customer portal - Customer registration and login - Mobile-first dashboard - Court booking requests with basic time-overlap checks - Upcoming / previous booking list - Monthly booking calendar - Loyalty points balance and transaction history - Configurable points earning and redemption at booking checkout ### Admin portal - Daily operational overview - Booking review, confirmation, manual payment recording, completion, and cancellation - Automatic reward points on paid + completed bookings - Automatic refund of redeemed points when a pending/confirmed booking is cancelled - Court setup and hourly pricing - Manual expense tracking and monthly income/expense snapshot - Reward program settings ## Technology and requirements - PHP 8.2 or later recommended - MySQL 8 / MariaDB supported by your Hostinger plan - PDO MySQL extension enabled - HTTPS enabled on the production domain - No framework, Composer, or Node.js is required to run the PHP application The customer and administrator experiences are currently served from the root `index.php` using query-based pages. The application uses a small amount of vanilla JavaScript for confirmation prompts and service-worker registration. Booking, authentication, rewards, and database logic are handled in PHP. ## Local setup 1. Create a MySQL database. 2. Import `database/schema.sql` using phpMyAdmin or the MySQL command line. 3. Copy `config/database.example.php` to `config/database.php`. 4. Put your local database name, username, password, and host into `config/database.php`. 5. Run the project using PHP's built-in server from this directory: ```bash php -S 127.0.0.1:8000 ``` 6. Open `http://127.0.0.1:8000`. 7. Register a customer account. 8. Promote the first account to administrator from the database (replace the email): ```sql UPDATE users SET role = 'admin' WHERE email = 'your-admin-email@example.com'; ``` 9. Log out and log back in. Open the Admin portal, add the real courts and hourly rates, and set the actual rewards policy. ## Hostinger deployment 1. Create the MySQL database and user in Hostinger hPanel. 2. Import `database/schema.sql` in phpMyAdmin. 3. Upload the repository contents to the domain's `public_html` directory (or the document root assigned to the app subdomain). 4. In the deployed `config` directory, create `database.php` from `database.example.php` and enter the Hostinger database credentials. This file is excluded from Git by `.gitignore`. 5. Enable a valid SSL certificate and force HTTPS. 6. Register your first account, promote it to `admin` using the SQL query above, add the actual courts and rates, and configure reward rules. 7. Test on a staging subdomain before using the production domain. Hostinger's MySQL host value is shown in the database details in hPanel; do not assume it is `localhost` if the panel specifies another host. ## Android / Google Play packaging plan This PHP app runs on the server; PHP is not compiled into an Android APK. The planned Android distribution path is: 1. Deploy the app to its final HTTPS domain/subdomain. 2. Upload the final app icons and brand logo. Replace the temporary icon assets and add valid 192x192 and 512x512 PNG files at `assets/icons/icon-192.png` and `assets/icons/icon-512.png`. 3. Verify the PWA manifest and service worker on the final domain. 4. Use Google's Trusted Web Activity / Bubblewrap tooling to generate the Android wrapper project from the live web app. 5. Configure the Android application ID, signing key, versioning, and Digital Asset Links (`/.well-known/assetlinks.json`). 6. Build a signed Android App Bundle (AAB), test on physical Android devices, and submit it through Play Console. The generated Android wrapper uses Android build files (Gradle and a manifest); this is a packaging layer only. The booking application remains PHP/HTML on Hostinger. A final domain, production HTTPS, brand assets, and Android signing certificate are required before TWA verification and Play Store release. ## Important setup and security notes - Do not commit `config/database.php`, database passwords, signing keys, or private customer exports. - The first registered user is a customer. Promote the intended owner account to admin manually in the database. - Registration does not allow users to choose the admin role. - Customer pages require login; admin pages check the admin role on the server. - The initial reward rule defaults (1 point per ₱100, 100 points for ₱50 off) are sample settings only. The administrator must confirm the real business policy before launch. - Payment handling in this starter is manual: an administrator records payment as paid. No GCash, Maya, card gateway, or bank API is integrated yet. - The finance screen is a basic operations summary, not a tax/accounting system. - The service worker only caches static assets. Authenticated PHP pages, booking details, and payment data are intentionally not cached. - Before production launch, perform security review, backup testing, privacy-policy preparation, Play Console policy checks, device QA, and load testing. ## Known next steps 1. Confirm the actual number of courts, names, operating hours, and hourly rates. 2. Confirm the point-earning and redemption policy. 3. Decide accepted payment methods and whether customers should submit payment references/proof. 4. Add owner-approved logo, app icon, screenshots, and final colors. 5. Add booking cancellation rules, admin/staff permissions, notification delivery, reporting filters, and audit logging. 6. Complete accessibility, security, and Android device testing before publication. ## Responsive design standards The UI uses a mobile-first design system in `assets/css/app.css`: - Phone layouts adapt at 600px and extra-narrow layouts at 370px; tablet layouts adapt at 820px. - Customer and admin navigation stays visible: a centered floating navigation bar on larger screens and a fixed thumb-friendly bottom bar on phones. - Mobile forms use full-width controls and a 16px input font to reduce accidental zooming on phones. - Dashboard cards, booking cards, filters, calendar rows, and admin actions wrap or stack on narrow viewports. - Bottom navigation respects the device safe-area inset. - Focus-visible styles support keyboard navigation, and reduced-motion preferences are respected. - The design uses local system-font fallbacks and CSS only; it does not require a CSS framework. Visual QA on real Android devices is still required after deployment. Test at minimum a narrow 320–360px phone, a typical 390–430px phone, a tablet width, and desktop before Play Store release. ## GitHub validation A GitHub Actions workflow at `.github/workflows/php-check.yml` runs PHP syntax checks and validates the PWA manifest on pushes and pull requests to `main`. ## Preview the app directly from GitHub The repository includes a GitHub Codespaces development environment. It runs the PHP application and a separate temporary MySQL database so you can preview both role-based dashboards before Hostinger deployment. 1. Open the repository: https://github.com/jasonmraz5/talisay-pickle-park 2. Click the green **Code** button. 3. Select the **Codespaces** tab. 4. Click **Create codespace on main**. 5. Wait for the Codespace container to build and initialize its preview database. 6. The preview should open automatically when port **8000** is forwarded. If it does not, open the **Ports** panel, find port **8000**, and click **Open in Browser**. 7. Log in with either preview account below to inspect each role's screens. ### Preview-only login accounts | Role | Email | Password | |---|---|---| | Administrator | admin@preview.talisay.local | PreviewOnly123! | | Customer | player@preview.talisay.local | PreviewOnly123! | These accounts, court names, prices, bookings, and payments are fabricated demo records in the Codespaces-only MySQL container. They are not production credentials and are not intended for Hostinger. Do not copy the preview database password into production. ### Important preview notes - The Codespaces port is configured as **private** by default. Do not change it to public for this preview. - Codespaces runs a temporary development database. It is separate from Hostinger and does not contain real park/customer information. - The Codespace changes the working copy, not the live Hostinger website. Commit and push any code changes you want to retain in GitHub. - The PHP app itself remains PHP/HTML/CSS/JavaScript; Docker Compose is only the disposable preview environment. - GitHub Pages cannot run this PHP application. Use Codespaces for this PHP preview; use Hostinger for the real deployment. For more information, see GitHub's [Codespaces port forwarding guide](https://docs.github.com/en/codespaces/developing-in-a-codespace/forwarding-ports-in-your-codespace). ## Installable Android preview APK The repository includes a standalone offline Android preview under `android-preview/`. It embeds a prototype UI in a native Android WebView so it can be installed and viewed before Hostinger deployment. The preview includes: - Customer and administrator preview modes (use the top-right role switch). - Home dashboards, sample bookings, upcoming booking list, seven-day calendar, sample rewards, and sample admin finance view. - A sample booking flow that stores demo bookings locally on the phone. - Administrator actions for confirming, marking paid, and completing sample bookings. **This is a UI/interaction preview only.** It does not connect to Hostinger, the PHP/MySQL database, real accounts, real payments, or a live booking calendar. Its sample data is stored locally on that device and is not shared with another phone. Do not use this preview for actual customer reservations or financial records. ### Build / download the APK from GitHub 1. Open the repository's **Actions** tab. 2. Select **Build Android preview APK**. 3. Open the latest successful run. 4. Under **Artifacts**, download `talisay-pickle-park-android-preview`. 5. Extract the ZIP file; it contains `app-debug.apk`. 6. Transfer the APK to your Android phone and install it. Android may ask you to allow installation from the browser or file manager you used. The workflow builds a debug APK for device testing. It is not a Play Store release build and is not signed with the final production release key. The final Play Store package will be produced after connecting the PHP app to the Hostinger HTTPS domain and completing the production Android packaging and signing setup. ## Preview branding and login update The offline Android preview now opens on separate Customer Login and Admin Login screens. Use the tabs on the login page to switch between roles. - Customer preview: `player@talisaypreview.com` / `Player123!` - Admin preview: `admin@talisaypreview.com` / `Admin123!` Both credentials are demo-only and work only inside the offline preview APK. The launcher app icon and in-app brand mark use a pickleball paddle and perforated ball symbol. The official logo can replace this temporary mark when supplied.