# Delivery and the courier app

> This chapter covers delivery end to end: how a manager sets up zones and fees, how an order reaches a courier, how the courier works in the mobile app on…

> Machine translation, editorial review pending.

Source: https://docs.smaklad.pl/en/guide/delivery-courier/

> This chapter covers delivery end to end: how a manager sets up zones and fees, how an order reaches a courier, how the courier works in the mobile app on their phone, and how the dispatcher monitors deliveries in the admin panel.

## 1. The journey of a delivery order

```mermaid
flowchart LR
  A[Delivery order
website or phone] --> B[Zone and fee calculated
from the postcode]
  B --> C[Kitchen prepares
KDS screen]
  C --> D[Delivery available
or assigned to a courier]
  D --> E[Courier: take it →
picked up → on the way]
  E --> F{Handover}
  F -->|customer PIN correct| G[Delivered
photo, recipient]
  F -->|cannot deliver| H[Failed
reason]
```

1. The customer places an order on the website, or a staff member takes it by phone. The system determines the delivery zone from the postcode and adds the delivery fee.
2. The kitchen prepares the order. When the dishes are ready, the delivery appears in the couriers' **"Available"** list, or the dispatcher assigns it straight to a specific courier.
3. The courier picks up the order, drives to the customer and confirms the handover with a **code (PIN)** that the customer sees on their order page.
4. The customer sees the delivery status on the website; the manager sees it in the panel under "Sales → Deliveries".

## 2. Delivery setup (manager)

### 2.1. Delivery zones by postcode

The manager defines zones in **Sales → Deliveries → Zones**. A zone has:

- **postcodes**: a full postcode (`31-128`) or a prefix with an asterisk (`31-1*` — all postcodes starting with 31-1);
- delivery fee, minimum order amount, free delivery threshold, estimated time;
- a boundary on the map (optional if postcodes are specified).

How the system finds the zone for an address:

1. **A customer on the website** enters the postcode in a separate field. The same postcode must also appear in the address itself. If the address contains a different postcode or none at all, delivery is not calculated ("Could not find the address").
2. **A staff member** (phone order) writes the address on one line, and the postcode is taken from it. If the line contains two different postcodes, the system does not guess, and the order is accepted without a delivery fee and with a warning.
3. If **no geocoder is connected**, the zone is determined by postcode only. The customer then pays the zone's fixed price, with no distance surcharge. If the postcode matches several zones, the most expensive one is used. The order gets the mark **"address not verified by the geocoder"**, which the manager and courier can see.
4. If **a geocoder is connected**, the address point must lie within the postcode's zone. If the geocoder did not respond or the point is in another zone, delivery is not calculated; the system does not fall back to a cheaper option.

Messages shown to the customer on the website: "Some dishes in the basket are currently out of stock", "Could not find the address…", "We do not deliver to this address yet", "The order is below the minimum for delivery to your zone", "Delivery cannot be calculated right now…".

## 3. The courier app (`/delivery`)

### 3.1. Sign-in and the delivery list

1. Sign in with a courier account (role `driver`).
2. **Deliveries** — two lists: **Mine** (assigned to you) and **Available**. They refresh every 20 seconds and with the "Refresh" button.
3. The GPS status is shown at the top. Your position is used to show the distance to the address and a navigation button; while you have active deliveries, it is sent to the server every 30 seconds so that the dispatcher can see the courier. If the customer's address could not be found on the map (the zone was determined by postcode only), the distance is not shown and "Navigate" searches for the address as text — check it before setting off.
   - **Pick-up** — the address from the company profile (administration → Settings → General: address, postcode, city).
   - **Delivery fee** — the amount the customer paid; "free" if the order is above the zone's free delivery threshold.
   - **Planned** — the arrival time (assignment time + the zone's and the route's estimated minutes). If the time has not been calculated, "—" is shown.
4. The delivery card shows the order number, the number of items and the **"Cash to collect"** amount: the order total minus what the customer has already paid online (taking refunds into account). The amount is recalculated on every payment or refund and at the moment you pick up the order. "Paid" is shown only if the order has been paid in full; if the system cannot verify the payment, the full amount remains to be collected.
5. **History** — your completed deliveries (delivered / failed), page by page.
6. **Profile** — phone and vehicle, plus availability: **Available for orders** or **Off duty**. The system sets "Busy" itself while you are carrying an order. While you have assigned or in-progress deliveries, you cannot switch to "Available for orders": the app answers "You still have active deliveries…"; "Off duty" can always be selected. After the last delivery the system sets the status back to "Available" by itself. More details in section 3.1a.

![Courier's delivery list](https://docs.smaklad.pl/img/delivery-01-dashboard.png)

### 3.1a. Courier profile (`/delivery/profile`)

The **"Profile"** tab in the bottom menu opens the **"My profile"** page. It is used to mark the start and end of a shift, change the language and sign out.

**What is on the page:**
- **Courier card**: first and last name, the account e-mail, phone, vehicle ("Car", "Scooter" or "Bicycle") and the vehicle registration number, if set. The courier cannot change these details. The hint under the card reads: "Name, phone and vehicle are maintained by the dispatcher in the admin panel" (the manager, in "Sales → Deliveries → Drivers").
- **"My availability"** — two toggles:
  - **"Available for orders"** — you are on shift, and the dispatcher can assign deliveries to you;
  - **"Off duty"** — you are not working, and nothing is assigned to you.
- **"Language"** — Polish, English, Ukrainian or Russian. The page reloads immediately in the selected language.
- The **"Log out"** button ends the session and returns you to the sign-in screen.

The courier does not choose the **"Busy" status** themselves. While you have a delivery in progress, "You are on a delivery (busy) — the status changes back automatically when it is closed" is shown above the toggles, and "Available for orders" is unavailable. "Off duty" can always be selected — for example, if the shift has ended and the order has been handed over to another courier.

**How it works:**
1. At the start of the shift, open "Profile" and choose "Available for orders". The status is saved immediately; there is no "Save" button.
2. At the end of the shift, choose "Off duty".
3. The system sets and clears the "Busy" status (based on the assignment and closing of deliveries). The dispatcher can change your status in the admin panel.

**Messages on this page:**

| Message | Cause | What to do |
|---|---|---|
| "You still have active deliveries. Finish them before switching to "available"." | there are assigned or in-progress deliveries | close the deliveries (delivered / failed) |
| "Your account has no courier profile — ask the dispatcher to create one." | the account with the `driver` role has not been added to the courier list | the manager adds the courier in "Sales → Deliveries → Drivers" |
| "Your session has expired — please sign in again." | the sign-in has expired | sign in again (the app returns you to the sign-in screen itself) |
| "Cannot reach the server. Please try again." | no internet connection | check the connection and try again |

While the courier profile has not loaded (or does not exist), the page shows only the name and e-mail from the account, the language selection and "Log out". There are no availability toggles in this case.

### 3.2. Taking and carrying an order

1. In "Available", tap **"Take it"** (a double tap takes the delivery only once). If another courier has already taken the delivery, a message appears and the list refreshes.
2. On the card or the delivery page, tap the next step: **"I picked up the order"** → **"Heading to the customer"**. The **"Navigate"** button opens the map.
3. Once the delivery is assigned, its page shows the recipient's name and phone number (the **"Call"** button), the order contents and the amount to collect. Available deliveries do not show contact details.

![Delivery page with a timeline](https://docs.smaklad.pl/img/delivery-02-detail.png)

### 3.3. Confirming the handover

1. At the "On the way" step, ask the customer for the **4-digit code (PIN)** — the customer sees it on the order page — and enter it in the handover form. The courier does not see the code in advance.
2. The code is checked by the server. If the code is wrong, "Wrong code. Attempts left: N" appears. After **5 wrong attempts** the handover is locked: call the manager, who removes the lock in the admin panel. All attempts are logged.
3. Optionally take a **handover photo** (phone camera, image only, up to 5 MB; the app shrinks the picture itself). The photo can be uploaded while on the way and for 30 minutes after the handover; only the manager and the administrator can see it.
4. Optionally enter who received the order and a comment. Tap **"Delivered"** and confirm in the "Confirm the delivery?" dialog. The status becomes "delivered", and you return to the list.

![Handover form](https://docs.smaklad.pl/img/delivery-03-proof.png)

### 3.4. Failed delivery

**"Cannot deliver"** → choose a reason (customer absent, wrong address, refused, damaged, other) and add a comment if needed. For "other" a comment is mandatory.

![Failed delivery dialog](https://docs.smaklad.pl/img/delivery-04-fail.png)

### 3.5. What cannot be changed and how to correct it

- Statuses only move forward: available → assigned → dispatched → picked up → on the way → delivered / failed. A delivery cannot be moved back to a previous step from the app.
- A delivery marked by mistake is corrected by the dispatcher in the admin panel.

### 3.6. Common errors

| Message | Cause | What to do |
|---|---|---|
| "Someone else has already taken this delivery" | A race when taking the delivery | Choose another one |
| "This status change is not allowed" | The status was changed in the panel | Reload the page |
| "This app is for couriers only" | The account does not have the `driver` role | Contact the manager |
| "Enter the delivery code from the customer" | The PIN was not entered | Ask the customer for the code |
| "Wrong code. Attempts left: N" | The customer gave the wrong code | Check the code on the customer's order page |
| "Too many wrong codes. Call the dispatcher to unlock this delivery." | 5 wrong codes | The manager removes the lock: "Sales → Deliveries → Unlock PIN" |
| "The photo is larger than 5 MB" / "Only JPEG, PNG or WebP photos are accepted" | The file is > 5 MB or not JPEG/PNG/WebP | Take a new picture |
| "Photo storage is unavailable" | The file storage is not responding | Tap "Delivered" without a photo and inform the manager |
| The order comment shows "[food ready @ …]" | An internal timestamp of when the kitchen finished the food | Ignore it |
| "A photo can no longer be attached to this delivery" | More than 30 minutes have passed since the handover, or there is already a photo | Inform the manager |

### 3.7. Admin panel: deliveries

The **Sales → Deliveries** section is available to the administrator and the manager (couriers who sign in to the panel are sent to their own app `/delivery/`). For each delivery you can see **whether the PIN has been confirmed** and **whether it is locked**; the **"Unlock PIN"** button resets the attempt counter (the action is logged). The **"Proof photo"** link opens the picture uploaded by the courier.

## 4. Monitoring deliveries in the admin panel

![Deliveries in the admin panel](https://docs.smaklad.pl/img/sales-12-deliveries.png)

In **Sales → Deliveries** the manager sees all of the day's deliveries with the courier, status and times, and can assign a delivery to a courier, remove a PIN lock and open the handover photo (more details in section 3.7).

## 5. A courier's working day — in brief

1. Open the `/delivery` app on the phone and allow access to location and the camera.
2. In "Profile", set the status to **"Available"**.
3. Take deliveries from "Available" or carry out those assigned by the dispatcher.
4. For each delivery: **"I picked up the order" → "Heading to the customer" → customer code → "Delivered"** (with a photo if needed).
5. If delivery is impossible — **"Cannot deliver"** with a reason.
6. Hand the cash received from customers over to the manager: in the system, the order payment is registered by the manager in the "Payments" section.
7. At the end of the shift, set the status to **"Off duty"**.
