> For the complete documentation index, see [llms.txt](https://docs.automaktab.uz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.automaktab.uz/toliq-funksional-xarita/tolovlar.md).

# To'lovlar — To'liq Imkoniyatlar

## Ro'yxat (PaymentsPage)

### Snapshot Cards

| Card              | Source                 | Details          |
| ----------------- | ---------------------- | ---------------- |
| Bugungi daromad   | GET /payments/snapshot | Today's total    |
| Oylik daromad     | GET /payments/snapshot | Month total      |
| Jami qarzdorlik   | GET /payments/snapshot | Outstanding debt |
| Qarzdor talabalar | GET /payments/snapshot | Count            |

### Filter Bar (URL-persisted)

| Filter        | Type     | Options                                |
| ------------- | -------- | -------------------------------------- |
| Filial        | Select   | cross-tenant only                      |
| Holat         | Select   | paid / unpaid / all                    |
| Usul          | Select   | naqd / karta / perechisleniya          |
| Kurs turi     | Select   | tezkor / avto\_maktab                  |
| Sana tezkor   | Buttons  | today / week / month / lastMonth / all |
| Sana kalendar | Calendar | range mode                             |
| Qidiruv       | Input    | student name, debounced                |

### Period Summary

* Filter active bo'lganda ko'rinadi
* Cards: collected sum, payment count, period debt

### Saralash

* index, student\_name, branch, course\_type, total\_price, amount\_paid, remaining\_debt, date
* Client-side, URL-persisted

### Ustunlar

index, student name, branch, course type (badge), total price, amount paid, remaining debt (red/green: "Fully paid"), date, actions

***

## Yaratish (PaymentModal)

### Student Select

* Combobox with search (debounced 300ms)
* Loading / error / empty states
* Pagination hint
* Locked student mode (from detail page)

### Form Fields

* **Amount:** grouped digits display, strip non-digits on submit
* **Payment method:** naqd / karta / perechisleniya

### Security

* **Idempotency key:** `crypto.randomUUID()` per modal open
* **Over-debt guard:** amount > debt → confirmation dialog

### Edit Mode

* Amount and payment method only (PATCH)
* Pre-payment debt reconstruction from `remaining_debt + amount_paid`

***

## Xatoliklar

* Duplicate submission prevented (idempotency key)
* Submit error banner with retry
* Network error → toast
* Debt exceed → confirm dialog

***

## Excel Export

* Button → fetchAllPayments() → xlsx download
* Cross-tenant only (tooltip: "Faqat egasi uchun")
* Translated column headers

***

## Cache Invalidatsiya

Payment mutations invalidate:

* `paymentKeys.all` (all payment queries)
* `studentKeys.all` (debt changes)
* `dashboardKeys.all` (KPI changes)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.automaktab.uz/toliq-funksional-xarita/tolovlar.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
