 <?php

require_once("../api/conn.php");
 ?>

<!DOCTYPE html>
<html class="loading" lang="en" data-textdirection="ltr">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <meta name="description" content="CryptoDash admin is super flexible, powerful, clean &amp; modern responsive bootstrap 4 admin template with unlimited possibilities with bitcoin dashboard.">
    <meta name="keywords" content="admin template, CryptoDash Cryptocurrency Dashboard Template, dashboard template, flat admin template, responsive admin template, web app, crypto dashboard, bitcoin dashboard">
    <meta name="author" content="ThemeSelection">
    <title>Performance</title>
    <link rel="apple-touch-icon" href="app-assets/images/ico/logo.png">
    <link rel="shortcut icon" type="image/x-icon" href="app-assets/images/ico/favicon.png">
    <link href="https://fonts.googleapis.com/css?family=Muli:300,300i,400,400i,600,600i,700,700i|Comfortaa:300,400,500,700" rel="stylesheet">
    <!-- BEGIN VENDOR CSS-->
    <link rel="stylesheet" type="text/css" href="app-assets/css/vendors.css">
    <!-- END VENDOR CSS-->
    <!-- BEGIN MODERN CSS-->
    <link rel="stylesheet" type="text/css" href="app-assets/css/app.css">
    <!-- END MODERN CSS-->
    <!-- BEGIN Page Level CSS-->
    <link rel="stylesheet" type="text/css" href="app-assets/css/core/menu/menu-types/vertical-compact-menu.css">
    <link rel="stylesheet" type="text/css" href="app-assets/vendors/css/cryptocoins/cryptocoins.css">
    <link rel="stylesheet" type="text/css" href="app-assets/css/pages/buy-ico.css">
    <!-- END Page Level CSS-->
    <!-- BEGIN Custom CSS-->
    <link rel="stylesheet" type="text/css" href="assets/css/style.css">
    <!-- END Custom CSS-->
    <!-- <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> -->
    <!-- <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="preconnect" href="https://fonts.googleapis.com" />
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap"> -->
    <link rel="stylesheet" href="https://cdn.datatables.net/2.1.2/css/dataTables.dataTables.css">
  
  </head>
  <body class="vertical-layout vertical-compact-menu content-detached-right-sidebar   menu-expanded fixed-navbar" data-open="click" data-menu="vertical-compact-menu" data-col="content-detached-right-sidebar">

    <!-- fixed-top-->
    <nav class="header-navbar navbar-expand-md navbar navbar-with-menu navbar-without-dd-arrow fixed-top navbar-light navbar-bg-color">
      <div class="navbar-wrapper">
        <div class="navbar-header d-md-none">
          <ul class="nav navbar-nav flex-row">
            <li class="nav-item mobile-menu d-md-none mr-auto"><a class="nav-link nav-menu-main menu-toggle hidden-xs" href="#"><i class="ft-menu font-large-1"></i></a></li>
            <li class="nav-item d-md-none"><a class="navbar-brand" href="index.php"><img class="brand-logo d-none d-md-block" alt="CryptoDash admin logo" src="app-assets/images/logo/logo.png"><img class="brand-logo d-sm-block d-md-none" alt="CryptoDash admin logo sm" src="app-assets/images/logo/logo-sm.png"></a></li>
            <li class="nav-item d-md-none"><a class="nav-link open-navbar-container" data-toggle="collapse" data-target="#navbar-mobile"><i class="la la-ellipsis-v">   </i></a></li>
          </ul>
        </div>
        <div class="navbar-container">
          <div class="collapse navbar-collapse" id="navbar-mobile">
            <ul class="nav navbar-nav mr-auto float-left">
              <li class="nav-item d-none d-md-block"><a class="nav-link nav-menu-main menu-toggle hidden-xs" href="#"><i class="ft-menu">         </i></a></li>
              <li class="nav-item nav-search"><a class="nav-link nav-link-search" href="#"><i class="ficon ft-search"></i></a>
                <div class="search-input">
                  <input class="input" type="text" placeholder="Explore CryptoDash...">
                </div>
              </li>
            </ul>
            <ul class="nav navbar-nav float-right">
                <ul class="dropdown-menu dropdown-menu-media dropdown-menu-right">
                </ul>
              </li>
<!--              <li class="dropdown dropdown-notification nav-item"><a class="nav-link nav-link-label" href="loans.html"><i class="ficon icon-wallet"></i></a></li>-->
              <li class="dropdown dropdown-user nav-item"><a class="dropdown-toggle nav-link dropdown-user-link" href="#" data-toggle="dropdown">             <span class="avatar avatar-online"><img src="app-assets/images/portrait/small/avatar-s-1.png" alt="avatar"></span><span class="mr-1"><span class="user-name text-bold-700"></span></span></a>
                <div class="dropdown-menu dropdown-menu-right">             <!--<a class="dropdown-item" href="account-profile.html"><i class="ft-award"></i>John Doe</a>
                  <div class="dropdown-divider"></div><a class="dropdown-item" href="account-profile.html"><i class="ft-user"></i> Profile</a><a class="dropdown-item" href="loans.html"><i class="icon-wallet"></i> My Wallet</a><a class="dropdown-item" href="start_off_days.html"><i class="ft-check-square"></i> Transactions              </a>-->
                  <div class="dropdown-divider"></div><a class="dropdown-item" href="login.php"><i class="ft-power"></i> Logout</a>
                </div>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </nav>

    <!-- ////////////////////////////////////////////////////////////////////////////-->


    <div class="main-menu menu-fixed menu-dark menu-bg-default rounded menu-accordion menu-shadow">
      <div class="main-menu-content"><a class="navigation-brand d-none d-md-block d-lg-block d-xl-block" href="index.php"><img class="brand-logo" alt="CryptoDash admin logo" src="app-assets/images/logo/logo.png"/></a>
        <ul class="navigation navigation-main" id="main-menu-navigation" data-menu="menu-navigation">
          <li class=" nav-item"><a href="index.php"><i class="icon-grid"></i><span class="menu-title" data-i18n="">Dashboard</span></a>
          </li>
          <li class="nav-item"><a href="performance.php"><i class="icon-layers"></i><span class="menu-title" data-i18n="">Performance</span></a>
          </li>
          <li class=" nav-item"><a href="loans.php"><i class="icon-wallet"></i><span class="menu-title" data-i18n="">Loans</span></a>
          </li>
          <li class=" nav-item"><a href="start_off_days.php"><i class="icon-shuffle"></i><span class="menu-title" data-i18n="">Start-Off-Days</span></a>
          </li>
           <li class=" nav-item"><a href="schemes.php"><i class="fa fa-cloud"></i><span class="menu-title" data-i18n="">Schemes</span></a>
          </li>
          <li class=" active"><a href="backup.php"><i class="fa fa-refresh"></i><span class="menu-title" data-i18n="">Backup</span></a>
          </li>

        </ul>
      </div>
    </div>

    <div class="app-content content">
        <div class="content-wrapper">
            <div class="content-header row">
                <div class="content-header-left col-md-8 col-12 mb-2 breadcrumb-new">
                    <h4 class="content-header-title mb-0 d-inline-block">Contract Schemes</h4>
                    <div class="row breadcrumbs-top d-inline-block">
                        <div class="breadcrumb-wrapper col-12">
                            <ol class="breadcrumb">
                                <li class="breadcrumb-item"><a href="index.php">Dashboard</a>
                                </li>
                            </ol>
                        </div>
                    </div>
                </div>
            </div>



            <div class="row">
                <!-- <div class="col-md-8 col-12">
                    <div class="card pull-up">
                        <div class="card-content">
                            <div class="card-body">
                                <div class="col-12">
                                    <div class="row">
                                        <div class="col-md-8 col-12">
                                            <p><strong>Number of Field Officers</strong></p>
                                            <h1>25</h1>
                                            <p class="mb-0">Welcome bonus <strong>+30%</strong> expires in 21 days.</p>
                                        </div>
                                        <div class="col-md-4 col-12 text-center text-md-right">
                                            <button type="button" class="btn-gradient-secondary mt-2">Loans Report <i class="la la-angle-right"></i></button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div> -->
                <!--<div class="col-md-4 col-12">
                    <div class="card">
                        <div class="card-content collapse show">
                            <div class="card-body">
                                <div class="font-small-3 clearfix">
                                    <p><strong>Risk Est %</strong></p>
                                    <span class="float-left">0%</span>
                                    <span class="float-right">100%</span>
                                </div>
                                <div class="progress progress-sm my-1 box-shadow-2">
                                    <div class="progress-bar bg-warning" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
                                </div>
                                <div class="font-small-3 clearfix">
                                    <p><strong>Recovery Est %</strong></p>
                                    <span class="float-left">0%</span>
                                    <span class="float-right">100%</span>
                                </div>
                                <div class="progress progress-sm my-1 box-shadow-2">
                                    <div class="progress-bar bg-warning" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
                                </div>
                                <div class="font-small-3 clearfix">
                                    <span class="float-left">Total Visited Growers <br> <strong>500/1500</strong></span>
                                   <span class="float-right text-right">Total Loan  <br> <strong>372,458.88 USD</strong></span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>-->

            </div>

            <!--/ Recent Transactions -->
            <!-- Basic Horizontal Timeline -->
            <div class="row">
                <div class="col-8">
                    <div class="card">
                        <div class="card-content collapse show">
                            <div class="card-body">
                                <form class="form-horizontal form-purchase-token row" >
                                    <div class="col-md-5 col-12">
                                        <label for="">By Field Officer</label>
                                        <fieldset class="form-label-group mb-0">
                                            <select type="text" class="form-control" id="ico-token" value="5000" required="" autofocus="">
                                                <option>Select Field-Officer</option>
                                                <option>Mazhanje tim</option>
                                                <option>Mazhanje tim</option>
                                                <option>Mazhanje tim</option>
                                                <option>Mazhanje tim</option>
                                                <option>Mazhanje tim</option>
                                            </select>
                                        </fieldset>
                                    </div>
                                    <div class="col-md-5 col-12">
                                        <label for="">By Scheme</label>
                                        <fieldset class="form-label-group mb-0">
                                            <select type="text" class="form-control" id="" value="1" required="" autofocus="">
                                                <option value="">Select Scheme</option>
                                                <option value="">Scheme A</option>
                                                <option value="">Scheme B</option>
                                                <option value="">Scheme C</option>
                                                <option value="">Scheme D</option>
                                                </select>
                                        </fieldset>
                                    </div>
                                    
                                   
                                </form>
                                <br>
                                    <div class="row">
                                        <div class="col-md-2 col-12 text-center">
                                            <button type="submit" class="btn-gradient-secondary">Search</button>
                                        </div>
                                        <div class="col-md-4 col-12 text-center">
                                            <button type="submit" class="btn-gradient-primary">Generate Report</button>
                                        </div>

                                    </div>
                            </div>
                            
                        </div>
                    </div>
                </div>
            </div>
            <div class="row match-height">
                <div class="col-xl-12 col-lg-12"> 
                    <div class="card">
                        <div class="card-content" data-bs-spy="scroll" style="max-height:10%">
                            <div class="card-body" data-bs-spy="scroll" style="max-height:10%">
                                <div class='table-responsive' >
                                    <table id="example" class="table table-hover table-xl mb-0">
                                        <thead>
                                            <tr>
                                                <th class="border-top-0">Grower</th>
                                                <th class="border-top-0">Name</th>
                                                <th class="border-top-0">Ha</th>
                                                <th class="border-top-0">Scheme</th>
                                                <th class="border-top-0">Area</th>
                                                <th class="border-top-0">Province</th>
                                                <th class="border-top-0">Field Officer</th>
                                                <th class="border-top-0">Season</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php


                                                $seasonid=0;
                                                $name="";

                                                $sql11 = "Select * from  seasons where active=1 ";

                                                $result = $conn->query($sql11);
                                                 
                                                 if ($result->num_rows > 0) {
                                                   // output data of each row
                                                   while($row = $result->fetch_assoc()) {
                                                    // echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";

                                                    $seasonid=$row["id"];
                                                    $name=$row["name"];

                                                   
                                                   }
                                                 }



                                                  $sql1 = "Select distinct grower_num,quantity,scheme_hectares.seasonid,scheme.description,area,province,surname,name from scheme_hectares_growers join growers on scheme_hectares_growers.growerid=growers.id join scheme_hectares on scheme_hectares.id=scheme_hectares_growers.scheme_hectaresid join scheme on scheme.id=scheme_hectares.schemeid  where scheme_hectares.seasonid=$seasonid";
                                                  $result1 = $conn->query($sql1);
                                                   
                                                   if ($result1->num_rows > 0) {
                                                     // output data of each row
                                                     while($row1 = $result1->fetch_assoc()) {
                                                      // echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";

                                                     

                                                    echo "<tr>";
                                                     echo "   <td class='text-truncate'>".$row1["grower_num"]."</td>";
                                                     echo "   <td class='text-truncate'>".$row1["name"]." ".$row1["surname"]."</td>";
                                                      echo "  <td class='text-truncate p-1'>".$row1["quantity"]."</td>";
                                                      echo "  <td class='text-truncate'>".$row1["description"]."</td>";
                                                      echo "  <td class='text-truncate'>".$row1["area"]."</td>";
                                                      echo "  <td class='text-truncate'>".$row1["province"]."</td>";
                                                      echo "  <td class='text-truncate'>".""."</td>";
                                                      echo "  <td class='text-truncate'>".$name."</td>";
                                                   echo " </tr>";


                                                      
                                                     }
                                                   }



                                            ?>
                                           
                                            
                                           
                                            
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!--////////////////////////////////////////////////////////////////////////////-->


    <footer class="footer footer-static footer-transparent">
      <p class="clearfix blue-grey lighten-2 text-sm-center mb-0 px-2"><span class="float-md-left d-block d-md-inline-block">Copyright  &copy; <script>
          document.write(new Date().getFullYear())
          </script> <a class="text-bold-800 grey darken-2" href="https://www.coreafricagrp.com/" target="_blank">Core Africa Group</a>, All rights reserved. </span><span class="float-md-right d-block d-md-inline-blockd-none d-lg-block"></span></p>
    </footer>

    <!-- BEGIN VENDOR JS-->
    <script src="app-assets/vendors/js/vendors.min.js" type="text/javascript"></script>
    <!-- BEGIN VENDOR JS-->
    <!-- BEGIN PAGE VENDOR JS-->
    <!-- END PAGE VENDOR JS-->
    <!-- BEGIN MODERN JS-->
    <script src="app-assets/js/core/app-menu.js" type="text/javascript"></script>
    <script src="app-assets/js/core/app.js" type="text/javascript"></script>
    <!-- END MODERN JS-->
    <!-- BEGIN PAGE LEVEL JS-->
    <!-- END PAGE LEVEL JS-->
     <script>
        new DataTable('#example', {
            paging: false,
            scrollCollapse: true,
            scrollY: '200px'
        });
     </script>
  </body>
</html>