🌾 GoldLeaf Farm Management Platform

Complete User Guide β€” Admin Portal & Android App

Table of Contents

  1. Platform Overview
  2. Admin Portal Guide
    1. Login & Demo Mode
    2. Dashboard
    3. Farmers (Review & Status)
    4. Farms
    5. Map View
    6. Crop Master
    7. Field Officers
    8. Lab Results & Batches
    9. Pipeline Stages
    10. Growth Pipeline (Kanban)
    11. Blockchain Records
    12. Seasonal Plans
    13. Compliance Checklist
    14. Soil Tests
    15. Farm Plots & Rotation
    16. Statistics
  3. Android App Guide
    1. Login & Registration
    2. Dashboard
    3. Farm Management
    4. Crop Management
    5. Growth Pipeline
    6. Seasonal Planning
    7. Compliance Tracking
    8. Soil Profile
    9. Farm Plots & Rotation
    10. Input Tracking
    11. Advisory Services (AI, Weather)
    12. Certification & Quality
    13. Training & Videos
    14. Profile & Settings
  4. Data Flow & Sync
  5. User Roles & Permissions
  6. Troubleshooting

1. Platform Overview

GoldLeaf is a complete farm management platform with two interfaces that share the same data:

InterfaceURL / AccessPurposeWho Uses It
Admin PortalWeb browser at https://api.goldleaflabs.co.ke/Manage all farmers, farms, crops, lab tests, blockchain, and system configurationFarm managers, administrators, field officers, lab technicians
Android AppInstall on farmer's Android deviceDaily farm operations: crop tracking, planning, compliance, soil tests, weather, AI advisoryFarmers and field workers in the field
Key concept: The Android app works offline-first. Data is saved locally on the phone and syncs to the server when internet is available. The admin portal always reflects the latest synced data from all farmers.

2. Admin Portal Guide

Access at https://api.goldleaflabs.co.ke/. The admin portal has 16 sections accessible from the left sidebar.

2.1 Login & Demo Mode

Normal Login: Enter your email and password, then click Sign In. If 2FA is enabled, enter the OTP sent to your registered phone.

Demo Mode: Add ?demo=jonathan to the URL to bypass login and explore the portal with sample data. Example: https://api.goldleaflabs.co.ke/?demo=jonathan. A yellow banner at the top confirms Demo Mode is active.

Demo Mode limitations: API calls are not authenticated in demo mode. Some features that depend on live data may show placeholder content.

2.2 Dashboard

The first page you see after login. It shows a wallet card for Ethereum blockchain integration:

Below the wallet, the dashboard used to display stats cards (Total Farmers, Total Farms, etc.) β€” these have been moved to the Statistics page.

2.3 Farmers

Manage all registered farmers. This is the main tool for reviewing and approving farmer accounts.

What you see:

Review Button (Action column): Click to open the farmer review modal:

Farmer status controls what they can do on the Android app:
β€’ Active / Verified β€” Full access: login, sync, create farms, add crops, use all features
β€’ Registered β€” Can log in but cannot create farms or sync data. Account pending review
β€’ Rejected β€” Cannot log in. Farmer sees "Account rejected" message

2.4 Farms

View all registered farms across all farmers.

What you see:

Farm Details Modal (comprehensive view):

Farm editing: Farm details are edited from the Android app by the farmer. The admin portal is view-only for farms.

2.5 Map View

Geographic visualization of all farms on an interactive Leaflet map.

Wrong location? If a farm marker appears in the wrong place (e.g. Texas instead of Kerugoya), the GPS coordinates stored for that farm need to be corrected. The farmer can update the location from the Android app by editing the farm's GPS coordinates.

2.6 Crop Master

The central catalog of all crop types that farmers can plant.

The Crop Master feeds into the mobile app's "Add Crop" flow. When a farmer selects a crop to plant, they choose from the types catalogued here.

2.7 Field Officers

Manage field officers who oversee farms and verify data on the ground.

2.8 Lab Results & Batches

Two tabs under this section: Lab Tests and Batches.

Lab Tests Tab

Batches Tab

2.9 Pipeline Stages

Configure the crop growth pipeline stages. These define the stages a crop passes through from planning to harvest.

Default stages: Seed Preparation β†’ Planting β†’ Germination β†’ Vegetative β†’ Flowering β†’ Fruit Development β†’ Maturation β†’ Harvest β†’ Completed / Failed. The pipeline is the single source of truth β€” the Android app reads these stages from the server and displays them as a slider.

2.10 Growth Pipeline (Kanban)

Visual kanban board showing all crops organized by their current pipeline stage. Drag-and-drop is not supported β€” click the Advance button to move a crop forward.

No backward sliding: Crops cannot move to a previous stage. This is enforced both server-side and in the Android app.

2.11 Blockchain Records

Track each batch's lifecycle through four blockchain-recorded stages:

2.12 Seasonal Plans

View all seasonal plans created by farmers across all farms. Farmers create these from the Android app.

Filter card: Narrow down by:

Table: Title, Farmer, Farm, Event Type, Season, Start Date, Status (color badge), Last Synced

2.13 Compliance Checklist

View all compliance checklist items created by farmers. Tracks regulatory and certification requirements.

Filter card:

Table: Item, Farmer, Farm, Category (badge), Status (color badge), Evidence (link button if URL provided), Due Date, Last Synced

2.14 Soil Tests

View all soil test records synced from farmers' Android apps.

Filter card:

Table: Date, Farmer, Farm, Soil Type, pH, N (Nitrogen ppm), P (Phosphorus ppm), K (Potassium ppm), Lab Name

2.15 Farm Plots & Rotation

View farm subdivisions (plots/sections) created by farmers and their crop rotation history.

Filter card: Farmer, Farm, Search (plot name)

Table:

Rotation History Modal:

Rotation Cycle: LEGUME β†’ LEAFY β†’ ROOT β†’ FRUIT β†’ CEREAL β†’ CUCURBIT β†’ ALLIUM β†’ NIGHT_SHADE β†’ LEGUME (repeats). The system recommends the next group but does not enforce it β€” the farmer can still plant any crop.

2.16 Statistics

Aggregated statistics for the entire system:

2.17 Harvest Deliveries

Track crop deliveries from farmers. The admin confirms what was actually received versus what the farmer declared.

Flow:

  1. Farmer declares harvest β€” Records quantity harvested in the Android app
  2. Admin confirms delivery β€” Click "Confirm Delivery" and enter:
    • Farmer β€” Select from dropdown
    • Declared Qty (kg) β€” What the farmer reported
    • Confirmed Qty (kg) β€” What the admin actually received
    • Grade β€” Premium, Standard, or Reject
    • Date β€” Delivery date
    • Notes β€” Optional
  3. System calculates: Reject = Declared βˆ’ Confirmed. Shown in the table as a badge (green if 0, warning if > 0)
  4. Farmer notified β€” A notification is created for the farmer: "Your harvest delivery of X kg has been confirmed"

Table columns: Date, Farmer, Declared, Confirmed, Reject (badge), Grade, Batch Code, Notes

Filters: Farmer dropdown

2.18 Batch Sales

Record sales of product batches to buyers. This is how trade income is tracked for calculating farmer payments.

Record Sale:

  1. Click "Record Sale" button
  2. Select the Batch being sold
  3. Enter Buyer Name
  4. Enter Quantity (kg) sold
  5. Enter Unit Price (KSh/kg) β€” total is auto-calculated
  6. Enter Date and optional Notes
  7. Click Save

Table columns: Date, Batch Code, Buyer, Qty Sold, Unit Price, Total, Notes

Rate calculation: When paying farmers, the system calculates: Rate = Total Sale Amount Γ· Total Declared Kg (across all farmers for that batch). Each farmer's gross pay = Their declared Kg Γ— Rate.

2.19 Payments & M-PESA

Initiate M-PESA payments to farmers. The system calculates the payment based on declared harvest, sale rate, and deductions.

Payment Flow:

  1. Select Farmer β€” The system auto-loads their total declared harvest and previously paid amounts
  2. Enter Rate (KSh/kg) β€” Automatically calculated from batch sales, but can be overridden
  3. Enter Deductions β€” Transport costs, commission fees, sorting charges, etc.
  4. Review Breakdown:
    • Gross = Declared Kg Γ— Rate
    • Deductions = Total of all deductions
    • Net = Gross βˆ’ Deductions (this is what the farmer receives)
  5. Confirm M-PESA Phone β€” The farmer's registered M-PESA number is pre-filled
  6. Click "Send via M-PESA" β€” The system calls the Safaricom Daraja API

Payment Statuses:

Table columns: Date, Farmer, Gross, Deductions, Net, M-PESA Phone, Status (badge), Transaction ID

Filters: Farmer dropdown, Status dropdown (All / Pending / Success / Failed)

M-PESA Credentials Required: Before using payments, set your Safaricom Daraja API credentials in the .env file: MPESA_CONSUMER_KEY, MPESA_CONSUMER_SECRET, MPESA_SHORTCODE, MPESA_INITIATOR_NAME, and MPESA_INITIATOR_PASSWORD. Use the sandbox environment for testing.

2.20 Dashboard & Badge Counts

The admin dashboard now shows actionable alerts and summary statistics at a glance.

Dashboard Alerts:

Stat Cards:

Sidebar Badge Counts:

Red badges appear next to sidebar links showing counts that need attention:

Badges auto-refresh every 60 seconds.

3. Android App Guide

The mobile app is installed on the farmer's Android device. It works offline-first β€” all data is saved locally and syncs to the server.

3.1 Login & Registration

First time β€” Register:

  1. Step 1: Enter Name, Email, Phone, and Password
  2. Step 2: Enter your farm name and details
  3. Step 3: Location β€” The app fetches your GPS coordinates automatically. You can also search for your location
  4. Step 4: OTP Verification β€” An OTP is sent to your phone. Enter it to verify
  5. Done! You are logged in and on the dashboard

Returning user β€” Login:

  1. Enter your Email and Password
  2. If your account status is Rejected, you will see "Account rejected. Contact admin."
  3. If your account status is Registered, you can log in but cannot create farms or sync data until an admin approves your account
  4. If your account status is Active or Verified, you have full access

Forgot Password:

  1. Tap "Forgot Password" on the login screen
  2. Enter your email or phone
  3. Enter the OTP sent to your phone
  4. Set a new password

3.2 Dashboard

The main screen after login. Contains:

3.3 Farm Management

Add Farm:

  1. Tap Add Farm on the dashboard
  2. Enter: Farm Name, Size (acres/hectares), Soil Type
  3. Get GPS Location β€” The app uses your phone's GPS or searches for a location by name
  4. The address is automatically resolved from GPS coordinates (village, district, region, country)
  5. Tap Save β€” The farm is created locally and synced to the server

Farm Fencing:

  1. Tap Farm Fencing on the dashboard (Verified Farmers only)
  2. The map shows your farm's current boundaries
  3. Tap points on the map to draw or adjust the farm fence polygon
  4. The area is calculated automatically
  5. Save to update the boundaries

Edit Farm:

Farm details (name, GPS location, soil type) can be edited from the farm details screen. Changes are synced to the server.

3.4 Crop Management

Add Crop:

  1. Tap Add Crop on the dashboard
  2. Select a crop type from the Crop Master catalog
  3. A plot selection dialog appears:
    • Select the Plot (section of your farm) where this crop will be planted. If you haven't created plots, you can skip this
    • A rotation recommendation may appear based on what was planted in that plot previously
  4. The crop is saved and appears in your farm's crop list
  5. Enter variety and field details in the crop detail screen

My Crops:

Crop Details:

3.5 Growth Pipeline Slider

Inside Crop Details, a horizontal slider shows all pipeline stages with the current stage highlighted:

3.6 Seasonal Planning

Plan your farming activities across seasons.

3.7 Compliance Tracking

Track checklist items related to farm certifications, safety, environmental, and quality standards.

3.8 Soil Profile

Record and view soil test history for your farm.

3.9 Farm Plots & Rotation

Divide your farm into named sections (plots) to track what's planted where and manage crop rotation.

3.10 Input Tracking

Track farming inputs (seeds, fertilizer, pesticides) used for each crop.

3.11 Advisory Services

AI-powered advisory dashboard with multiple tools.

Advisory Dashboard:

Pest Detection:

Disease Detection:

Soil Analysis:

Weather Screen:

3.12 Certification & Quality

Batch Management:

Batch Details:

Quality Dashboard:

Consumer Verification:

3.13 Training & Videos

3.14 Profile & Settings

4. Data Flow & Sync

How data moves between the Android app and the server:

  1. Farmer creates/edits data on Android β€” The app saves to local Room database immediately (works offline)
  2. Sync upload β€” When internet is available, the app sends all changes to the server via POST /v1/sync/upload
  3. Server processes β€” The PHP backend inserts/updates records in the MySQL database
  4. Admin views data β€” The admin portal fetches data from the same MySQL database via API endpoints
  5. Sync download β€” The Android app periodically downloads updates from the server via GET /v1/sync/download

What data is synced:

Data TypeDirectionFrequency
Farmers, Farms, CropsTwo-wayOn every sync
Tasks, Growth StagesTwo-wayOn every sync
Seasonal PlansAndroid β†’ Server (dedicated endpoint)After each local change
Compliance ChecklistAndroid β†’ Server (dedicated endpoint)After each local change
Soil TestsAndroid β†’ Server (dedicated endpoint)After each local change
Farm PlotsAndroid β†’ Server (dedicated endpoint)After each local change
Weather DataServer β†’ Android (read-only)On demand
Pipeline StagesServer β†’ Android (read-only)On app start
Blockchain RecordsServer β†’ Android (read-only)On demand
Sync status is shown in the app (e.g., "Synced", "Sync: 4xx", "Offline - saved locally") so you always know whether your data has reached the server.

5. User Roles & Permissions

RoleWhoAndroid AccessAdmin Portal Access
Admin Farm manager / system admin β€” Full access to all sections
Farmer Basic account (newly registered) Dashboard, My Crops, Weather, Advisory, Training, Profile β€”
Verified Farmer Approved farmer with additional features All Farmer features + Farm Fencing, Pest/Disease Detection, Certification, Quality, Consumer Verification β€”
Field Officer Extension officer / field data collector Limited (managed in Admin Portal) View-only access to assigned data

Account Status Flow:

πŸ“ Farmer registers β†’ 🟑 Registered (pending review) β†’ πŸ‘¨β€πŸ’Ό Admin reviews β†’ πŸ”΅ Verified β†’ 🟒 Active

Or if rejected by admin: πŸ”΄ Rejected (cannot log in)

6. Troubleshooting

Android App Issues

ProblemLikely CauseSolution
App shows "Malformed JSON" errorServer returned a non-JSON response (PHP error)Check the admin portal API status. The server should return 200 with valid JSON. If this persists, contact support
"Account rejected" on loginAdmin has set your status to RejectedContact your farm manager or admin to reinstate your account
"0 farms" on dashboardNo farms created yet, or sync hasn't completedAdd a farm from the dashboard, or check your internet connection and pull-to-refresh
Sync fails with "pending review"Your account status is "Registered"Wait for admin to approve your account (change to Active or Verified)
Location shows wrong placeGPS coordinates were incorrect when the farm was createdEdit the farm from the app and update the GPS location
Can't advance crop stageNo backward sliding β€” or crop is at terminal stage (Completed/Failed)Only forward movement is allowed. Terminal stages cannot be advanced further
AI/Pest/Disease features not workingAPI keys for AI services not configured on the serverAsk admin to set up OpenAI, Gemini, or Plant.id API keys on the server

Admin Portal Issues

ProblemLikely CauseSolution
Page does not loadServer error or PHP issueCheck the server error logs. Try ?demo=jonathan to verify the page itself works
Data not showing / empty tablesNo data synced yet, or filter is activeClear filters and try again. Verify farmers have synced data from the Android app
"Failed to load farmer details"Server endpoint errorThe admin API is returning an error. Check the browser console for the exact error message
Map shows markers in wrong locationIncorrect GPS coordinates stored for farmsThe farmer needs to correct the farm location from their Android app
Can't see new Seasonal Plans / Compliance / Soil dataFarmers haven't synced yet, or filters are appliedCheck the Last Synced column. Reset all filters and search

Server Errors (PHP)

ErrorMeaningFix
Call to undefined method mysqli_stmt::get_result()Server PHP has no mysqlnd extensionInstall mysqlnd PHP extension, or upload the fixed controllers that use sqlFetchRow() instead
Class "AfricasTalking..." not foundMissing Composer dependencyRun composer require africastalking/africastalking on the server
Commands out of syncMySQLi statements not closed before reusingThis was fixed in the latest code β€” upload the updated controller files

GoldLeaf Farm Management Platform β€” User Guide v1.0
Last updated: June 2026