<!-- Main content -->
                <section class="content">

                    <!-- Small boxes (Stat box) -->
                    <div class="row">
				
						
                                <form role="form" action="<?php echo site_url('aqadmin/add_clients');?>" method="post" enctype="multipart/form-data" id="myForm">
                       <div class="col-md-6">
                            <!-- general form elements -->
                            <div class="box box-primary">
                                <div class="box-header">
                                    <h3 class="box-title">
                                        <?php

                                        if(empty($client_row))
                                        {
                                            echo "Add client";
                                        }
                                        else
                                        {
                                            echo "Edit client";
                                        }
                                        ?>
                                    </h3>
                                </div><!-- /.box-header -->
                                <!-- form start -->
                                <?php 
   if($this->session->flashdata('success_msg')){?>
     <div style="color:green"><?php echo $this->session->flashdata('success_msg');?></div>    
    <?php  } ?>
                                    <div class="box-body">
                                    <div class="form-group">
                                            <label for="exampleInputEmail1">Client Name</label>
                                            <input type="text" name="client_name" class="form-control" placeholder="Client name" value="<?php if(empty($client_row)) { echo set_value('client_name'); } else{ echo $client_row->client_name; } ?>" data-validation="required alphanumeric" data-validation-allowing=" " autocomplete="off">
                                            <?php if(form_error('client_name') != ""){?>     
     <div style="color:red"><?php echo "Enter client name.";?></div>
       <?php } ?> 
                                        </div>
                                        
                                    
           
            <div class="form-group">
                                            <label for="exampleInputEmail1">Client Logo</label>
                                            <input type="file" class="form-control" id="inputPassword3" placeholder="Client Logo" name="client_logo" <?php if(empty($client_row)) { ?> data-validation="required mime size" data-validation-max-size="500kb" data-validation-allowing="jpg, png, gif" data-validation-error-msg-size="You can not upload images larger than 500kb" data-validation-error-msg-mime="You can only upload images" data-validation-error-msg-required="No image selected"<?php } else {?> data-validation="mime size" data-validation-max-size="500kb" data-validation-allowing="jpg, png, gif" data-validation-error-msg-size="You can not upload images larger than 500kb" data-validation-error-msg-mime="You can only upload images" <?php }?> >
                                            <input type="hidden" name="old_client_logo" <?php if(!empty($client_row)) { ?> value="<?php echo $client_row->client_logo; ?>" <?php } ?>>
                                        <?php 
                                                                    if(!empty($client_row)){
                                                                        if($client_row->client_logo == NULL || $client_row->client_logo == "")
                                                                        {
                                                                            $src=base_url()."../uploads/client_logo/no_image.png";
                                                                        }
                                                                        else
                                                                        {
                                                                            $src = base_url()."../uploads/client_logo/thumbs/".$client_row->client_logo;
                                                                        }
                                                                        ?>
                                                                        <img src="<?php echo $src; ?>" style="height: 50px;">
                                                                        <?php
                                                                    }
                                                                    ?>
                                                                    <?php if(form_error('client_logo') != ""){?>     
                                                            <div style="color:red"><?php echo "Enter client logo.";?></div>
                                                            <?php } ?>
   
                                        </div>
                                        <div class="form-group">
                                            <label for="exampleInputEmail1">Nature of work</label>
                                            <select name="nature_of_work" class="form-control">
                                                <option value="Emergency" <?php if(!empty($client_row)) { if($client_row->nature_of_work=="Emergency") { ?> selected="selected"  <?php } } ?>>Emergency</option>
                                                <option value="One_Time_Service" <?php if(!empty($client_row)) { if($client_row->nature_of_work=="One_Time_Service") { ?> selected="selected"  <?php } } ?>>One Time Service</option>
                                                <option value="Annual_Maintenance" <?php if(!empty($client_row)) { if($client_row->nature_of_work=="Annual_Maintenance") { ?> selected="selected"  <?php } } ?>>AM Contract</option>
                                            </select>
                                            
       
                                        </div>
                                        <div class="form-group">
                                            <label for="exampleInputEmail1">Client Description</label>
                                            <textarea  name="description" class="form-control" placeholder="Description"><?php if(empty($client_row)) { echo set_value('description'); } else{ echo $client_row->description; } ?></textarea>
                                           
     
                                        </div>
                                    </div>
<div class="box-footer">
    <input type="hidden" name="id" value="<?php if(!empty($client_row)) { echo $client_row->id; } ?>">
                                        <button type="submit" class="btn btn-primary">Submit</button>
                                    </div>
                                    
                                
                            </div><!-- /.box -->

                            

                        
                    
                        </div>
                         
                               
                              
                                    
                                    
                                </form>
                            </div><!-- /.box -->

                            

                        </div>
                    
                        </div>
                    </div><!-- /.row -->

                    <!-- top row -->

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
        <script>
        
        $(window).on("beforeunload", function() {
            return "Are you sure? You didn't finish the form!";
        });
        
        $(document).ready(function() {
            $("#myForm").on("submit", function(e) {
                
                $(window).off("beforeunload");
                return true;
            });
        });
        </script>             
                                        
                     
                    
                    
