<?= $this->extend('Modules\Dashboard\Views\dashboard\index'); ?>

<?= $this->section('content');?>
  <div class="page-title">
    <h4>Districts</h4>
    <h6><a href="<?= base_url('dashboard');?>">Home</a> / <?= esc($bcrumb) ?></h6>
  </div>
  <div>
    <?php if(session()->getTempdata('error')):?>
    <div class="alert alert-danger">  <?= session()->getTempdata('error');?></div>
    <?php endif;?>
      <?php if(session()->getTempdata('success')):?>
      <div class="alert alert-success">  <?= session()->getTempdata('success');?></div>
      <?php endif;?>
			<?php if(session()->getTempdata('warning')):?>
      <div class="alert alert-warning">  <?= session()->getTempdata('warning');?></div>
      <?php endif;?> 					
  </div>

<div class="container-xxl p-0">
  <div class="row">
    <div class="col-lg-12 p-0"> 

        <!-- Display all Districts !-->
        <div class="card">
              
                <div class="card-body px-2">
                  <p class="card-title"><span class="display-2 fs-4 fw-bold text-secondary"> <i class="bi bi-three-dots"></i></span>
                  <?php if($userdata->group_id==1):?>
                    <button class="btn btn-sm btn-primary float-end" onclick="add_district()">Create New</button>
                    <?php endif; ?>
                  </p>
                
                <div id='general-error'></div>
                <div class="table-responsive">
                    <table id="district-list" class="table table-hover expandable-table w-100">
                        <thead>
                        <tr>
                            <th>#</th>
                            <th>Name</th>
                            <th width="10%">Counties</th>
                            <th width="10%">Options</th>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
               
        
    </div>
  </div>
</div>
     

<?= view('Modules\AdministrativeUnits\Views\district\modals\district_modal') ?>
<?= view('Modules\AdministrativeUnits\Views\district\modals\county_modal') ?>
<?= view('Modules\AdministrativeUnits\Views\district\modals\viewcounties_modal') ?>
<?= view('Modules\AdministrativeUnits\Views\district\modals\constituency_modal') ?>

<script src="<?=base_url('assets/js/Modules/administrativeunits/districts.js')?>"></script>

<?= $this->endSection();?>
