# Asystir CRM UI

Frontend PWA-style web app for the CRM API (`../crmapi`).

## Development

No service worker or manifest yet — refresh the browser to see changes.

Open:

```
http://localhost/WebSite/crmui/Index.html
```

## First login

Use the API key from `../crmapi/innerdoc/credentials.txt`:

```
crm_asystir_demo_key_change_in_production_2026
```

The key is stored in `localStorage` as `crmapikey`.

## UI reference

Mockups live in [`innerdocs/ui/`](ui/):

- `contactview.png` — read-only contact profile with quick actions
- `contactnew_edit.png` — new/edit form layout

## Structure

| File | Purpose |
|------|---------|
| `Index.html` | Main shell (list, view, form, login) |
| `css/base.css` | Theme, typography, shared components |
| `css/Contacts.css` | Contacts module styles |
| `js/Common.js` | API helpers, auth, formatting |
| `js/Contacts.js` | Contacts module logic |

## API mapping

List/search uses existing fields only:

- **Contact** — name, lastname, contacttype
- **Company** — resolved from `companycontactid` or company name
- **Type** — `typename` (employee, lead, client, …)
- **Status** — `status`
- **Phone / Email** — `phonemobile`, `email`

Contact view actions:

- **Call** — `tel:` link from primary phone
- **WhatsApp** — `web.whatsapp.com/send?phone=…`
- **Email** — `mailto:` link

## Config

API base URLs are in [`js/Common.js`](../js/Common.js). Adjust if your server path differs.
