---
title: Visits and their statuses
summary: A visit is one booking of a client for one or several services, taking a master, a place and a device. It is booked, confirmed, took place or cancelled; a visit without booking is recorded after the fact.
tools: [talemo_book_visit, talemo_record_walk_in, talemo_get_visit, talemo_list_visits, talemo_get_calendar]
related: [finding-times, moving-and-cancelling-visits, visit-notices, resources, services-and-prices, ../clients/contact-card]
search: [appointment, booking, status, walk-in]
---

# Visits

A visit ties together a client's card (see [Contact card](../clients/contact-card.md)),
a branch, one or several services, the resources they take and the time. All
services of a visit are booked, moved and cancelled together. A visit has one master, and a place and a device
are chosen for each service: a manicure on a table and a pedicure on a couch are one visit. Visits live in the
**Calendar** of the web app.

## Statuses

- **booked** — the visit exists and is waiting;
- **confirmed** — a person pressed **Confirm** on a booked visit;
- **took place** — the visit was closed with how it really went;
- **cancelled** — with a reason (see
  [Moving and cancelling visits](moving-and-cancelling-visits.md)).

**Not closed** is a mark on a visit and lies outside the four statuses. A booked or confirmed visit whose time has
passed carries it until a person marks it as took place or cancels it. The Calendar
shows how many visits are not closed, and **Visits not closed** lists them with
**Sort out**. Until they are sorted, the takings of those days are incomplete.

## Booking

A visit is booked through the finder (see [Finding times](finding-times.md)) with
`talemo_book_visit`: the client's card, the services, the start and, if wanted, the
resources. The start must be on the booking step, in the future, inside open time and
free. A card in **Not sorted** becomes a client when a visit is booked for it.

If the person is not in the contacts yet, a **new client** is named instead of a card: a name and a
phone number (in the booking window, **For whom → New client**; in the tools, `new_party` instead of
`party_id`, exactly one of the two). Talemo looks for the number among the phones and WhatsApp numbers of
your contacts. Found — the visit goes to that card under the name it already has, the typed name is not
saved, and the person sees whose card it was booked for. Not found — Talemo adds a client card and books
it; the history of the contact keeps a line, "Created the card when booking a visit". It needs the right
to add contacts and an open Phone field; without the right the answer is "You don't have the right to add
clients. Pick one from your contacts or ask the owner for this right." The preview (`dry_run`) does not
look the number up: it always shows a new card with the name typed.

The online admin books, moves and cancels visits too, but only for the client it is
talking to in that chat.

## Prices

Each service of a visit takes its price and currency from the price list when the
visit is booked (see [Services, prices and currency](services-and-prices.md)).
Changing the price list does not change booked visits. **Change the price** edits the
prices of one visit only, and the history of the visit keeps who changed them and
when. A role denied the field Price does not see the prices of visits at all.

When a service has its own price for a level of masters (see
[Levels of masters](master-levels.md)), the visit takes the price of the master it is
booked with: the price of his level, or the usual one for a master with no level and for a
level with no price of its own. The price the client was shown — on the booking page, or told by
the online admin or a connected tool — is checked at booking: if the price of the master has
changed since, nothing is booked, the new price is shown and the visit is booked again with
it. A visit that is already booked keeps its price when the master moves to another level.

## A visit that took place

**Close the visit** writes down how it really was: the time, who did it, which
services and how much was paid. It goes into the same visit, and the plan stays in
its history. Closing a closed visit again corrects it, and every correction is kept.
The master's real time is the time of the visit. The place and the device stay as they were
booked: a service that was in the booking keeps its booked stretch with the cleanup, and
closing does not move it after the real time. A service added at closing gets a share of
the real time, split between the services by their lengths in the price list. Its place is
the same as the neighbouring service's if it fits; if several places fit, you can choose it in the
dialog. A service left out frees its place. In the card of the visit every place and device names
the services it is taken for: the booking remembers this link, and closing with a shifted time,
closing again and a price correction do not change it, so the table stays with the manicure and
the couch with the pedicure. For visits booked before the link was remembered, a service is put
on the place of its role that its real time overlaps the longest.

## Visit without booking

**Visit without booking** records a client who came without booking. It is written
at once as took place and is always in the past: its end cannot be later than now. The
finder and the step are not used, only the real time. If that time lies outside the
open time of a resource, **Extend the day and record** opens it in that resource's
day, and the day becomes "changed by hand". The tool is `talemo_record_walk_in`. No
confirmation or reminder is made for it. The client is named as in booking: by a card, or as
a new client by name and number. A manicure on a table and a pedicure on a couch are one
visit of one master, as in booking; when a service fits several places, name the one that
was used for each service.

## Who can do it

Finding, viewing, booking, changing, moving, cancelling, recording and deleting are
separate rights at branch level; the Administrator role has them. A right can be limited
to own: the person then sees and books only visits on the resource they work as.

## Tools and refusals

- A visit is booked only through the finder: `talemo_find_times` first, then `talemo_book_visit` with `party_id` (the card of the client) or `new_party` (a new client: `name` and `phone` with `address` and, for a number without `+`, `country`; exactly one of the two, or `request.body_invalid`), `service_ids`, the `start` of a variant and its `resource_ids`. A variant goes as it is. Booking checks the start again, so the time can be gone by then: status 409, code `slot.overlap`; time outside the open time of a resource is `visit.outside_schedule` with `params.resource_id`, unless `extend_schedule` opens it (below); a start in the past is `visit.past`; a start off the step is `request.body_invalid` with `params.field` `start`; a resource that does not do the services is status 422, code `visit.resource_unfit`. A contact from the unsorted category becomes a client. With `new_party` the answer of a real booking carries `party_match`: `found` — a card with that number existed and the visit went to it under its own name, `created` — the card was added; the preview carries no `party_match`. Without the right to add contacts the refusal is status 403, code `role.forbidden`, `params.capability` `party.create`: tell the person they have no right to add clients and offer to pick one from the contacts or to ask the owner for the right; a role that closes the Phone field gets `role.field_forbidden`.
- Statuses: booked, confirmed, done (it took place) and cancelled. `talemo_get_visit` shows one visit with the services in order, who is taken when and, if the role may see them, the prices. `talemo_list_visits` lists, in `visits`, the visits of a branch for a period, of one contact (`party_id`), or with `unclosed` those of the past that are still booked or confirmed and need to be recorded as done or cancelled. `talemo_get_calendar` shows the grid of one to seven days and counts the unclosed ones in `unclosed_count`.
- `own_resource_ids` is in the answers of `talemo_list_visits` (next to `visits`) and `talemo_get_calendar` only when the person sees just the visits of the resources linked to them: the IDs of those resources. Empty — no resource in the calendar is linked to them yet, so their own visits cannot show; absent — they see all the visits of the branch.
- If booking is turned off for a master who still has visits, their column stays in the calendar marked ‘not taking bookings’: the visits are there, but no new time can be booked. Booking is turned back on in their card. The column of a switched-off resource comes without visits too when `talemo_get_calendar` names it in `resource_id` (a question about one master, place or device), and always for the person’s own switched-off resource when the person sees just their own visits. A resource from `resource_id` that does not exist, is not visible to the role or lies in another branch is status 404, code `not_found`, `params.field` `resource_id` and `params.reason` `not_found` or `not_in_branch`; a value that is not a uuid is `request.body_invalid` with the same field. Tell the person that there is no such master in the calendar of this branch, and do not put another one in its place.
- Every visit has a `source`: `page` when the client booked it herself on the booking page of the branch (see [Branch booking page](branch-booking-page.md)), `salon` for every other one, whether a person, the online admin or a connected tool booked it. `talemo_get_visit`, `talemo_list_visits` and `talemo_get_calendar` show it.
- A visit of the past is recorded with `talemo_record_walk_in`, done at once, with `party_id` or `new_party`, `service_ids`, `start`, `end`, optionally `resource_ids`, `service_resources` (which place or device did which service, as pairs of `service_id` and `resource_id`; the master stays in `resource_ids`, and a resource that does not fit its service is refused with `visit.resource_unfit`) and `price`. It ends no later than now, or it is refused with status 409, code `visit.future`. A time outside the open time of a resource is refused with `visit.outside_schedule` unless `extend_schedule` opens it in the day of the resource: say so to the person first.
- When the person asks to book at a time that is not open, say what would open and ask: a day off, hours beyond the shift or a resource with no schedule. When they say yes, `talemo_book_visit` with `extend_schedule` true and the master, place or device in `resource_ids` opens exactly the time of the visit in the day of each named resource and books in the same step; without the flag the refusal stays `visit.outside_schedule`. It needs the right to edit the schedule: without it status 403, code `role.forbidden`, `params.capability` `schedule.edit`. The answer lists what was opened in `opened` — `resource_id`, `name`, `kind` (`day_off`, `outside_shift` or `no_schedule`), `start`, `end` and, for `outside_shift`, the `shift` it stood in — and `asks` lists what the person is to hear first: `opens_time`, and `client_message` when Talemo writes to the client at once that the visit is booked; `dry_run` shows both and books nothing. Busy time such as a lunch stays closed even with the flag, and the time of a resource that is not named is never opened. The assistant of a person in the mode **Ask what matters** books on its own while `asks` is empty and otherwise shows a card and waits for **Allow**; in **Approve every action** it always waits. The online admin does not open time: it offers another start. The finder never offers busy or closed time (see [Schedule of a resource](resource-schedule.md)).
- The services of a visit take their price from the price list when it is booked, in the currency of the branch; when a service has a price for a level of masters, the price of the master of the visit.
- `talemo_book_visit` takes `price`: the prices the client was told, in the order of `service_ids` — the `price` of each entry of `services` in the variant you book, decimals in the currency of the branch like "35.00", `null` for a service with no price. Pass it whenever the variant has prices; left out, the visit is booked at the price of its master with no check. If the price of the master has changed since the variant was found, nothing is booked: status 409, code `visit.price_changed`, `params.service_id` of the first service that differs and `params.price`, its price now. Tell the client the new price, find the times again and book only if they agree. `level_id` books with the masters of one level when no master is in `resource_ids` (the `level_id` of a master in `fits` of `talemo_list_services`, or `none` for the masters with no level); the rule of the branch picks the master inside the level.
