=== SapvaDok ===
Contributors: LamzDev
Tags: appointment, doctor, clinic, booking, queue
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.4.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Doctor scheduling, online appointment booking, and walk-in queue management for hospitals, clinics, and medical practices.

== Description ==

SapvaDok helps hospitals and clinics manage doctors, practice schedules, branches, specialties, patient appointment requests, and daily walk-in queues through your WordPress website.

**Key features**

* Manage doctor profiles (photo, bio, credentials, specialty, branch)
* Practice schedules by day and branch with automatic booking slots
* Public appointment page with calendar and patient form
* Doctor search filters (name, specialty, branch)
* Appointment status workflow: pending, confirmed, cancelled
* Email notifications for staff and patients
* WhatsApp (wa.me) links for manual confirmation by reception staff
* User roles: Receptionist, Medical Admin, and Administrator
* Export appointments to CSV
* Honeypot anti-spam on the booking form
* **Walk-in queue** per doctor or counter (loket/CS) with daily prefix and quota
* **Queue admin panel** — issue numbers, call next, skip, recall, complete
* **TV waiting-room display** — fullscreen board for all active queues
* **Voice announcements** on TV (Indonesian TTS, selectable voice)
* **QR code on TV** — patients scan to track the queue on their phone
* **Mobile live queue page** — auto-refreshing status without staying in the waiting room
* **Loket/CS mode** — queue-only entries hidden from the online booking page

**Shortcodes**

* `[sapvadok_janji_temu]` — full appointment page (doctor list + booking)
* `[sapvadok_doctors]` — doctor list with filters
* `[sapvadok_booking doctor_id="123"]` — booking form for one doctor
* `[sapvadok_queue_tv]` — TV queue board (all doctors)
* `[sapvadok_queue_take]` — kiosk page to take a walk-in number
* `[sapvadok_queue_mobile]` — mobile live queue tracker

**Auto-created public pages**

On activation, the plugin creates utility pages (hidden from the front-end menu by default):

* `janji-temu` — online appointments
* `antrian-tv` — TV display
* `ambil-antrian` — take queue number
* `antrian-live` — mobile queue tracker (linked from TV QR code)

**No paid external services required.** The plugin runs entirely on your WordPress server.

== Installation ==

1. Upload the `SapvaDok` folder to `/wp-content/plugins/` or install via **Plugins → Add New** in WordPress.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Open **SapvaDok → Settings** to configure notification emails, slot intervals, booking options, and TV voice settings.
4. Create **Branches** and **Specialties**, then add doctors with their practice schedules.
5. Enable **walk-in queue** per doctor under **Add/Edit Doctor → Queue Settings** (prefix, daily quota).
6. The public **Janji Temu** page is created automatically on activation (slug: `janji-temu`). Queue and TV pages are also created automatically.
7. Open **SapvaDok → TV Queue Display** for the waiting-room screen, or **Manage Queue** for reception.

== Frequently Asked Questions ==

= Is this plugin free? =

Yes. SapvaDok is licensed under GPLv2+ and free to use.

= Do patients need to log in to book? =

No. Visitors can submit appointment requests without a WordPress account.

= How do I confirm an appointment? =

Staff open **SapvaDok → Manage Appointments** and change the status to *Confirmed* or *Cancelled*. Patients may receive email notifications when enabled in settings.

= Is WhatsApp sent automatically? =

No. The plugin provides wa.me links with pre-filled messages so staff can contact patients manually via WhatsApp.

= How does the walk-in queue work? =

Enable queue settings on a doctor (or loket/counter). Patients take a number from the kiosk page or reception. Staff manage the queue in **Manage Queue**; the TV board and mobile tracker update automatically.

= Can I add a counter (loket) without showing it on the booking page? =

Yes. Check **Queue only (loket/CS — hide from appointments)** in the doctor form. The entry stays on the TV board and kiosk but is hidden from **Janji Temu**.

= Why are queue pages not in my site menu? =

Utility pages (TV, kiosk, mobile tracker) are excluded from the front-end navigation automatically. Patients reach the mobile page by scanning the QR code on the TV.

= What happens when the plugin is deleted? =

If you **delete** (not just deactivate) the plugin, all SapvaDok data is removed: appointments, queues, doctors, branches, specialties, plugin pages, settings, and custom database tables.

= Is it compatible with page builders? =

Yes. Use shortcodes on pages or widgets. Auto-created pages use standalone templates where needed (e.g. fullscreen TV).

== Screenshots ==

1. SapvaDok admin dashboard — today's appointments and pending confirmations
2. Public appointment page — choose a doctor and search filters
3. Booking form — calendar, time slots, patient details, and insurance type
4. Manage appointments — list, filters, status, CSV export, and WhatsApp
5. Add doctor form — profile, practice schedule, and queue settings
6. TV queue display — multi-doctor board with QR code and voice announcements

== Changelog ==

= 1.4.1 =
* Enqueue queue ticket auto-print script via `wp_add_inline_script()` instead of inline `<script>` output
* Remove `load_plugin_textdomain()` (translations are loaded automatically on WordPress.org)
* Move the admin menu to a lower position (below Settings)

= 1.4.0 =
* **Custom TV theme** — preset colors (dark, light, teal, navy), custom colors, font scale, doctor photos, QR position, footer text

= 1.3.0 =
* **Daily statistics dashboard** — queue volume, average wait time, check-ins, busiest doctor, per-doctor breakdown
* **Duplicate booking detection** — blocks same phone + doctor + date; highlights duplicates in admin
* **TV branch filter** — show only queues for a branch via `?branch_id=` or `?cabang=slug`; per-branch TV links in admin

= 1.2.0 =
* **Appointment check-in → queue** — confirmed same-day appointments can be checked in to issue a queue number
* **Blocked dates** — block specific days off per doctor without changing weekly schedule
* **Print queue ticket** — thermal-friendly ticket from kiosk, Manage Queue, and after check-in

= 1.1.0 =
* Walk-in queue system with per-doctor/counter daily numbers, prefix, and quota
* Admin **Manage Queue** panel (take number, call next, skip, recall, complete)
* Fullscreen **TV queue board** showing all active doctors and counters
* **Voice call announcements** on TV with Indonesian TTS and voice selection
* **QR code on TV** linking to the mobile live queue tracker page
* **Mobile queue page** (`antrian-live`) with auto-refresh for patients
* **Kiosk take-number page** (`ambil-antrian`) for walk-in patients
* **Loket/CS mode** — queue-only entries hidden from online appointment booking
* Plugin utility pages automatically hidden from front-end navigation menus
* TV settings: voice priority keywords and speech rate (Settings → TV Queue Display)
* Skipped queue numbers can be recalled from the admin panel
* Hospital logo on admin dashboard header
* TV display improvements: fullscreen template, readable text on dark background, QR in corner
* Custom queue database table (`sapvadok_queues`) with activator and uninstall cleanup

= 1.0.0 =
* Initial release for WordPress.org
* Doctor, branch, specialty, and schedule management
* Online booking with calendar and slot validation
* Email notifications and WhatsApp links for staff
* Admin dashboard, CSV export, user roles, and honeypot anti-spam
* Public doctor profiles and migration from SiapDok legacy data

== Upgrade Notice ==

= 1.4.1 =
Code quality improvements for the WordPress.org plugin guidelines (script enqueuing, translations, and admin menu placement).

= 1.4.0 =
Customize the TV queue display theme under SapvaDok → Settings → TV Display Theme.

= 1.3.0 =
Adds daily stats on the dashboard, duplicate booking protection, and per-branch TV queue filtering.

= 1.2.0 =
Adds appointment check-in to queue, per-doctor blocked dates, and printable queue tickets.

= 1.1.0 =
Adds walk-in queue management, TV display with voice and QR code, mobile queue tracking, and loket/CS support. New database table and public pages are created automatically on upgrade.

= 1.0.0 =
First SapvaDok release on WordPress.org.

== Privacy Policy ==

SapvaDok stores appointment data submitted by patients through the website form, including name, phone number, email (optional), notes, appointment date/time, insurance choice (BPJS/general), and selected doctor.

Walk-in queue entries store queue numbers and optional patient details; names are not required for kiosk take-number.

Data is stored in your WordPress site database (custom tables and doctor post type). The plugin does not send data to third-party servers. Notification emails are sent via your WordPress `wp_mail()` function. WhatsApp links are wa.me URLs opened manually by staff. TV voice announcements use the browser's built-in speech synthesis (no audio sent to external APIs).

Site owners are responsible for privacy policies, patient consent, and compliance with applicable health and personal data regulations.
