# INNOINVOICE PRO project notes

This release keeps the project folder name `innoinvoice-pro` and brings the refreshed dark interface together with the existing PHP/MySQL application plus product/service catalogue, reports/CSV export, and subscription expiry tracking.

For setup and upgrade instructions, follow `README.md`. If an earlier installation already contains real data, back up the database and preserve the private `config/config.php` before copying updated files. The full fresh-install schema is `database/schema.sql`; existing installations should review `database/upgrade_existing.sql` and run only the missing migration pieces.

## Public catalogue presentation update

The public customer catalogue (`public/public-catalog.php`) now has a storefront-style hero, responsive product cards with product images and prices, per-product WhatsApp enquiry links, and a business contact panel showing the configured phone, email, and office address. WhatsApp links use the business profile phone number and prefill a product-specific enquiry; the visitor must still press Send in WhatsApp.

### Files changed for this update
- `public/public-catalog.php` — catalogue layout, product enquiry links, business contact panel, and WhatsApp link generation.
- `public/assets/style.css` — responsive catalogue hero, product cards, contact panel, and mobile layouts.

No database migration is required for this visual update. For product images, use a publicly reachable `https://` image URL in the product record. For WhatsApp, set the business phone in Business Settings; use an international number where possible. Nigerian local numbers beginning with `0` are converted to country code `234` for the chat link.

## Product image upload option
- Product/service forms now support direct image uploads (JPG, PNG, WEBP, GIF; maximum 5 MB) as well as the existing public image URL option.
- Uploaded files are stored in `public/uploads/products/` with generated filenames. The uploads directory blocks script execution via `.htaccess`.
- Uploaded images are displayed in the private product list and the public customer catalogue. Existing image URLs remain supported.
- No database migration is required; the existing `products.image_url` column stores either the URL or the relative uploaded-image path.
- Ensure the web server can write to `public/uploads/products/` (typically directory permissions 755, with ownership configured for the PHP/Apache user). Keep PHP's `file_uploads` enabled and `upload_max_filesize`/`post_max_size` at least 5M (preferably 8M).

## Customer management upgrade

This update adds editable customer records, soft-delete and restore actions, customer-added counts for today/week/month/year, and deletion counts plus a deleted-customer audit list. Customer deletion is a soft-delete so invoice history remains intact.

For an existing database, back up the database first, then run `database/upgrade_customers_management.sql` once in phpMyAdmin with the existing `innoinvoice_pro` database selected. If `customers.deleted_at` already exists, skip the `ALTER TABLE` migration (and verify the two indexes exist before adding them). Do not import `database/schema.sql` over an existing database.

Files changed for this upgrade:
- `public/customers.php`
- `public/invoice-create.php` (prevents deleted customers being selected for new invoices)
- `public/dashboard.php` (excludes deleted customers from the active customer count)
- `database/upgrade_customers_management.sql`

Existing customers that were physically deleted before this upgrade cannot be reconstructed in the deletion report; the report records soft-deletions made after the migration is installed.


## Registration phone numbers (admin contact details)

This update adds a required phone / WhatsApp field to new registrations and displays the number in Admin → User accounts, with click-to-call and WhatsApp links. It also displays the phone number alongside bank-transfer requests. Existing accounts will show `Not provided` until the user registers again (or their phone is added to the `users.phone` column).

For an existing database, back it up, then run `database/upgrade_user_phone.sql` once in phpMyAdmin with `innoinvoice_pro` selected. Do not import the entire schema over an existing database. Keep `config/config.php`.
