<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
      <div class="main my-0">
        <div class="row mt-3 mx-0">
          <div class="col-md-9">
            <h3>Manage <?php echo ucfirst($mgmtname);?></h3>
          </div>
          <div class="col-md-3 text-right">
		  
            <a href="account/products/listings" class="btn btn-success">GO BACK</a>
          </div>
        </div>
        
        <div class="container_fluid mt-2 px-3">
		<form name="frmsearch" method="get" action="account/<?php echo $mgmtname;?>/showall">
         <table class="webforms sttbl bg-light my-0 table-responsive-sm">
          <tr>
           <td class="pr-0" width="40%"><input type="text" name="search" size="20" value="<?php echo $this->input->get("search");?>" placeholder="search by name,address, manager,invoice prefix"></td>
		<td class="pr-0" width="20%">
		<select name="zoneid" id="zoneid" class="js-example-basic-single" >
		  <option value="">All Zones</option>
						<?php
						if(is_array($zonelist) && count(array_filter($zonelist))>0)
						{

							foreach($zonelist as $zonerow)
							{
								$sel_zone ="";
								if(decodeValue($this->input->get("zoneid"))==$zonerow->fld_id)
								{
									$sel_zone = 'selected="selected"';
								}				
									?>
											<option value="<?php echo encodeValue($zonerow->fld_id);?>" <?php echo $sel_zone;?>><?php echo $zonerow->fld_name;?></option>
									<?php
								
							}
						}
						?> 
		  </select>
		  </td>
           <td>
           	<button class="btn btn-dark pt-0 pb-1 px-2">Go</button>
           </td>
          </tr>
         </table>
       </form>
         <?php
			if($this->session->flashdata("message")!="" && $this->session->flashdata("alerttype")!="")
			{
         ?>
         <div class="text-center my-4">
			 <span class="alert <?php echo $this->session->flashdata("alerttype");?>"><?php echo $this->session->flashdata("message");?></span>
         </div>
         <?php
			}
         ?>
         
         <table class="table mt-2 table-responsive-sm">
		 <form name="frmlisting" id="frmlisting" action="<?php echo base_url()."account/".$mgmtname;?>" method="post" onsubmit=" return checkboxvalidate();">
                <thead>
                	<tr>
                    	<th width="5%">Serial</th>                    	
                    	<th width="15%">Name</th>
                    	<th width="25%">Address</th>
                    	<!--<th width="10%">Zone</th>
                    	<th width="15%">Manager Info.</th>//-->
                    	<th width="10%">Invoice Prefix</th>
                    	
                        <th width="10%" class="text-center">Show Status</th>
                    </tr>
                    </thead>
                    <tbody>
					<?php
					if(is_array($results) && count(array_filter($results))>0)
					{
						$rowindex = 0;
						foreach($results as $row)
						{
							$rowindex++;
							$managerinfo = $row->fld_managername;
							$statustext = "";
							if($row->fld_show=="yes")
							{
								$statustext = '<a href="account/outlets/showall?oid=' . encodeValue($row->fld_id) . '&sts=no"><span class="text-success"><strong>' . strtoupper($row->fld_show) . '</strong></span></a>';
							}
							else
							{
								$statustext = '<a href="account/outlets/showall?oid=' . encodeValue($row->fld_id) . '&sts=yes"><span class="text-danger"><strong>' . strtoupper($row->fld_show) . '</strong></span></a>';
							}
					?>
                    <tr>
                    	<td class="text-center"><?php echo $rowindex;?>.</td>                    	
                    	            
                    	<td><?php echo $row->fld_name;?></td>         
                    	<td><?php echo $row->fld_address;?></td>             
                    	<!--<td><?php echo $row->zonename;?></td>               
                    	<td><?php echo $managerinfo;?></td> //-->
						<td><?php echo $row->fld_invoiceprefix;?></td>
						<td class="text-center"><?php echo $statustext;?></td>
                    	
                    </tr>
                    <?php
						}
							
					}
					else
					{
                    ?>
                    <tr><td colspan="8" style="text-align:center">Record not found!</td></tr>
                    <?php
					}
                    ?>
                    
                    
                    </tbody>
                </table>
                 
	         <div class="clearfix"></div>
          
        </div>
        <div id="paginate" class="row">
			<?php echo $this->ajax_pagination->create_links(); ?>
        </div>
            
        </div>

