This commit is contained in:
2026-03-31 17:51:34 +02:00
parent ca8db7a9da
commit 1dbb8ab5da
4 changed files with 3244 additions and 36 deletions

35
.vscode/ftp-kr.json vendored
View File

@@ -1,17 +1,22 @@
{ {
"host": "host117523.hostido.net.pl", "host": "host117523.hostido.net.pl",
"username": "www@carei.pagedev.pl", "username": "www@carei.pagedev.pl",
"password": "FRKeFaBHHUkREqg9gqta", "password": "FRKeFaBHHUkREqg9gqta",
"remotePath": "/public_html", "remotePath": "/public_html",
"protocol": "ftp", "protocol": "ftp",
"port": 0, "port": 0,
"fileNameEncoding": "utf8", "fileNameEncoding": "utf8",
"autoUpload": true, "autoUpload": true,
"autoDelete": false, "autoDelete": false,
"autoDownload": false, "autoDownload": false,
"ignoreRemoteModification": true, "ignoreRemoteModification": true,
"ignore": [ "ignore": [
".git", ".git",
"/.vscode" "/.vscode",
] "/.claude",
"/.paul",
"/docs",
".env",
"CLAUDE.md"
]
} }

File diff suppressed because it is too large Load Diff

19
.vscode/sftp.json vendored
View File

@@ -1,11 +1,12 @@
{ {
"name": "My Server", "name": "carei.pagedev.pl",
"host": "localhost", "host": "host117523.hostido.net.pl",
"protocol": "sftp", "protocol": "ftp",
"port": 22, "port": 21,
"username": "username", "username": "www@carei.pagedev.pl",
"remotePath": "/", "password": "FRKeFaBHHUkREqg9gqta",
"uploadOnSave": false, "remotePath": "/public_html",
"useTempFile": false, "uploadOnSave": false,
"openSsh": false "useTempFile": false,
"openSsh": false
} }

63
CLAUDE.md Normal file
View File

@@ -0,0 +1,63 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
WordPress site for **Carei** (car rental) at `carei.pagedev.pl`. The core custom code is the **carei-reservation** plugin — a multi-step car reservation form integrated with the Softra Rent API, rendered as an Elementor widget.
## Architecture
### Custom Plugin: `wp-content/plugins/carei-reservation/`
```
carei-reservation.php — Plugin bootstrap, .env parsing, singleton init, asset registration
includes/
class-softra-api.php — Softra Rent API client (cURL, JWT token caching via WP transient)
class-rest-proxy.php — WP REST API proxy (namespace: carei/v1) exposing Softra endpoints to frontend
class-admin-panel.php — CPT carei_reservation for storing booking history, admin columns, status management
class-elementor-widget.php — Elementor widget rendering the reservation modal + multi-step form
assets/
js/carei-reservation.js — Vanilla JS: modal, form steps, API calls, validation, booking flow
css/carei-reservation.css — All form/modal styling
```
### Data Flow
1. Frontend JS calls WP REST endpoints (`/wp-json/carei/v1/...`)
2. `Carei_REST_Proxy` forwards requests to Softra Rent API via `Carei_Softra_API`
3. `Carei_Softra_API` handles JWT auth with automatic token caching (transient, 50min TTL)
4. On successful booking: reservation data saved as CPT `carei_reservation` with post meta
### Key API Endpoints (Softra Rent)
- `/account/auth` — JWT token
- `/branch/list` — Rental locations
- `/car/class/list` — Vehicle classes by date/branch
- `/pricelist/list` — Pricing with extras
- `/customer/add`, `/rent/makebooking`, `/rent/confirm` — Booking flow
### WP REST Routes (carei/v1)
`/branches`, `/car-classes`, `/car-classes-all`, `/segments-branches-map`, `/pricelist`, `/extras`, `/submit-booking`, `/agreement-defs`
## Configuration
- API credentials in `.env` at WordPress root (format: `key: value` — url, username, password)
- Deployment via SFTP to `host117523.hostido.net.pl:/public_html` (config in `.vscode/sftp.json`)
- Theme: Hello Elementor
## Development
- **No build tools** — pure PHP + vanilla JS + CSS, no npm/composer
- Test API connectivity: `php softra-test.php` (reads `.env`, authenticates, fetches branches and models)
- API documentation in `docs/rent-api-*.md` (transcribed from Softra PDF spec v1.15)
- Planning state tracked in `.paul/` (ROADMAP.md, PROJECT.md, phases/)
## Conventions
- Polish language throughout UI, comments, and admin labels
- Design tokens: primary `#2F2482`, accent `#FF0000`, font Albert Sans
- Admin reservation statuses: `nowe``przeczytane``zrealizowane`
- No JS frameworks — all frontend logic in single vanilla JS file
- No additional dependencies — keep the stack minimal (WordPress + Elementor only)