> ## Documentation Index
> Fetch the complete documentation index at: https://docs.escrivalimited.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Deliveries & Live Tracking

The Deliveries module is the heartbeat of the farmer's daily interaction with the Sasini ecosystem. It is designed to be highly responsive, fetching live data directly from the Sasini servers to ensure absolute accuracy and transparency.

## Initializing the Dashboard

When a user navigates to the Deliveries page, the app immediately establishes a secure connection to the Sasini backend.

<Steps>
  <Step title="The Steaming Cup (Loading State)" icon="mug-hot">
    Because data is never stored statically on the device, the app initiates an API call upon page load. While fetching, the user is presented with our signature **Steaming Cup Loading Indicator**—a beautiful, dynamic animation symbolizing our core commodities: Tea and Coffee.

    <div align="center">
      <video autoPlay loop muted playsInline style={{ maxWidth: '200px', borderRadius: '12px' }}>
        <source src="https://mintcdn.com/escrivalimited/Al_pFOMfRtFPAsJ8/images/steaming-cup-loading.mp4?fit=max&auto=format&n=Al_pFOMfRtFPAsJ8&q=85&s=ffb7913c5f6810f16df3e429ec4bca74" type="video/mp4" data-path="images/steaming-cup-loading.mp4" />
      </video>
    </div>
  </Step>

  <Step title="Default View: Current Month" icon="calendar-check">
    Upon a successful API response, the dashboard automatically populates with the **Current Month's** delivery data.

    <div align="center">
      <img src="https://mintcdn.com/escrivalimited/X0slFSrZLrxFPltT/images/deliveries-default-month.jpeg?fit=max&auto=format&n=X0slFSrZLrxFPltT&q=85&s=646f3813d8536115ddb2ac869b4491d7" alt="Current Month Deliveries" style={{width: '100%', maxWidth: '300px', margin: '0 auto', borderRadius: '12px', boxShadow: '0 4px 14px 0 rgba(118, 189, 34, 0.3)' }} width="715" height="1600" data-path="images/deliveries-default-month.jpeg" />
    </div>
  </Step>
</Steps>

<Note>
  **Network Resilience (The Refresh Button):** If the API takes too long to respond due to server cold-starts or poor network connectivity, a **Refresh 🔄** button becomes active. Tapping this manually re-triggers the data request without requiring the user to leave the page. It is located at the top right of the screen.
</Note>

***

## Interactive Daily Breakdowns

We believe in absolute transparency. The initial view provides a macro-summary of each day, but users can dig deeper.

<Card title="Granular Bag Breakdowns" icon="magnifying-glass" iconType="duotone" color="#76BD22">
  **The Tap Interaction:** By tapping on any specific daily delivery card, a detailed breakdown modal slides up.

  If a farmer delivered 20 bags on Tuesday, the breakdown will explicitly detail:

  * The exact time each individual bag was weighed.
  * The exact kilogram weight of every single bag.
  * The receipt number containing all the bags.
</Card>

<div align="center">
  <img src="https://mintcdn.com/escrivalimited/PiQzkTQ1pVHDD-zu/images/delivery-breakdown-modal.jpeg?fit=max&auto=format&n=PiQzkTQ1pVHDD-zu&q=85&s=4d3e1b6ed546bf4144fa48c36dbcb258" alt="Delivery Breakdown Modal" style={{ maxWidth: '300px', margin: '0 auto', borderRadius: '12px' }} width="647" height="844" data-path="images/delivery-breakdown-modal.jpeg" />
</div>

***

## Advanced Time Filtering & AI Summaries

Farmers are not restricted to the current month; they can traverse their entire historical database using the robust filtering engine.

### Date Range Filtering 📊

Users can select a custom `Start Date` and `End Date`.

* **Manual Execution:** The data does not auto-refresh. The user must explicitly tap the **"Filter"** button to execute the new API call, saving their mobile data bandwidth.
* **Reset Function:** A quick "Reset Filters" button instantly returns the view to the current month.

<div align="center">
  <img src="https://mintcdn.com/escrivalimited/Tfg2eSKI_lZPlOMb/images/filtersdeliveries.jpeg?fit=max&auto=format&n=Tfg2eSKI_lZPlOMb&q=85&s=209f7ad5640c4ab0e34cb45396787e8f" alt="No Delivery Records Found" style={{ maxWidth: '300px', margin: '0 auto', borderRadius: '12px' }} width="714" height="373" data-path="images/filtersdeliveries.jpeg" />
</div>

***

<Warning>
  **The 31-Day Query Limit:** To maintain lightning-fast API response times, the system restricts queries to a maximum of 31 days. If a user selects a range spanning 45 days, the app instantly throws a stylized warning prompt: *"Please select a date range of 31 days or less."*
</Warning>

<div align="center">
  <img src="https://mintcdn.com/escrivalimited/Nookk2R2u8HLT8Q8/images/deliveries-filter-warning.jpeg?fit=max&auto=format&n=Nookk2R2u8HLT8Q8&q=85&s=5e6e26be7666444a787e5f40f21108ae" alt="Filter Warning Prompt" style={{ maxWidth: '300px', margin: '0 auto', borderRadius: '12px' }} width="417" height="141" data-path="images/deliveries-filter-warning.jpeg" />
</div>

<Note>
  **Empty States (No Records Found):** If the API returns a `200 OK` status but the data array is empty (meaning the farmer made zero deliveries in that selected timeframe), the app gracefully handles the null response. Instead of a blank screen or an error, it displays a friendly "No Records Found" illustration, preventing user confusion.
</Note>

<div align="center">
  <img src="https://mintcdn.com/escrivalimited/VnQr4ApsfQzTvfay/images/deliveries-no-records.jpeg?fit=max&auto=format&n=VnQr4ApsfQzTvfay&q=85&s=c393943441454947b26bd120e36774be" alt="No Delivery Records Found" style={{ maxWidth: '300px', margin: '0 auto', borderRadius: '12px' }} width="371" height="137" data-path="images/deliveries-no-records.jpeg" />
</div>

***

### AI Auto-Summary Statistics ✨

Once a date range is loaded, the integrated **Sasini AI** instantly analyzes the dataset and generates a top-level statistics card.

**Metrics Calculated:**

* 📦 Total Deliveries Count
* 🧺 Total Bags Delivered
* ⚖️ Total Cumulative Weight (Kgs)
* 📊 Average Weight per Bag
* 📈 Daily Average Delivery
* 🎯 Range of Kgs (Highest vs. Lowest performing days)

<div align="center">
  <img src="https://mintcdn.com/escrivalimited/PiQzkTQ1pVHDD-zu/images/deliveries-ai-summary.jpeg?fit=max&auto=format&n=PiQzkTQ1pVHDD-zu&q=85&s=3e3dd8892b45214e18ac6e28ce764217" alt="AI Statistics Summary" style={{ maxWidth: '300px', margin: '0 auto', borderRadius: '12px', boxShadow: '0 4px 14px 0 rgba(118, 189, 34, 0.3)' }} width="711" height="877" data-path="images/deliveries-ai-summary.jpeg" />
</div>

***

## Quality of Life Features

<Tip>
  **The Quick-Scroll Floating Action Button (FAB)**
  When browsing through a heavy month of daily deliveries, scrolling back to the top to change the filter can be tedious. We implemented a floating action button (⇪) pinned to the bottom right of the screen. **One tap instantly auto-scrolls the user smoothly to the very top of the dashboard.**
</Tip>

<div align="center">
  <img src="https://mintcdn.com/escrivalimited/U9hl2Ck6IH8TEQJ-/images/deliveries-fab-scroll.jpeg?fit=max&auto=format&n=U9hl2Ck6IH8TEQJ-&q=85&s=8c617efd9bd7454fe427c7d27fe35f47" alt="Auto Scroll Floating Button" style={{ maxWidth: '300px', margin: '0 auto', borderRadius: '12px' }} width="325" height="136" data-path="images/deliveries-fab-scroll.jpeg" />
</div>
