update
This commit is contained in:
63
CLAUDE.md
Normal file
63
CLAUDE.md
Normal 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)
|
||||
Reference in New Issue
Block a user