<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$this->load->view('layout/header'); 
$cityName = isset($cityVal)? $cityVal[0]->name : '';

//$cityId = array('id'=>'cityId','type'=>'text','class'=>'col-xs-10 col-sm-5','value'=>'','name'=>'cityId','placeholder'=>'City ID' );
$cityName = array('id'=>'cityName','type'=>'text','class'=>'col-xs-10','value'=>$cityName,'name'=>'cityName','placeholder'=>'City Name' );
?>

<div id="container">
    <div class="main-content">
        <div class="main-content-inner">
            <div class="breadcrumbs" id="breadcrumbs">
                <script type="text/javascript">
                    try {
                        ace.settings.check('breadcrumbs', 'fixed')
                    } catch (e) {
                    }
                </script>

                <ul class="breadcrumb">
                    <li>
                        <i class="ace-icon fa fa-home home-icon"></i>
                        <a href="#">Home</a>
                    </li>

                    <li>
                        <a href="#">Admin</a>
                    </li>
                    <li class="">
                        <a href="<?php echo site_url('City/manageCity'); ?>">City</a>
                    </li>
                    <li class="active">Edit City</li>
                </ul><!-- /.breadcrumb -->

             
            </div>

            <div class="page-content">
                <div class="page-header">
                    <h1>
                        City Management
                        <small>
                            <i class="ace-icon fa fa-angle-double-right"></i>
                            Edit City
                        </small>
                    </h1>
                </div><!-- /.page-header -->
                <?php 
               
                if($this->session->flashdata('error_message'))
                {
                
                ?>

                    <div class="alert alert-danger">
                        <button data-dismiss="alert" class="close" type="button">
                            <i class="ace-icon fa fa-times"></i>
                        </button>

                        <strong>
                            <i class="ace-icon fa fa-times"></i>
                            <?php
                            echo $this->session->flashdata('error_message');
                            ?>
                        </strong>

                    </div>
                <?php 
                
                }
                else if($this->session->flashdata('sucess_message'))
                {
                ?>
                        <div class="alert alert-block alert-success">
                        <button data-dismiss="alert" class="close" type="button">
                            <i class="ace-icon fa fa-times"></i>
                        </button>

                        <p>
                            <strong>
                                <i class="ace-icon fa fa-check"></i>
                               <?php
                                echo $this->session->flashdata('sucess_message');
                              ?>
                            </strong>
                            
                        </p>
                    </div>
                <?php
                }
                ?>
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        
                        <?php

//                        if(!isset($id))
//                        {
//                            $id = '';
//                        }

                        $hidden = array('class'=>'form-horizontal','role'=>'form');
                        echo form_open_multipart('City/updateCity',$hidden ); 
                       
                        ?>
                        <input type="hidden" name="cityid" value="<?php echo $id; ?>">
                            <div class="form-group col-lg-4">
                                <label class="col-sm-12" for="form-field-1"> City Name </label>

                                <div class="col-sm-12">
                                    <?php echo form_input($cityName); ?>
                                </div>
                            </div>
                            
                            <div class="modal-footer col-lg-12">
                               
                                <a href="<?php echo site_url('City/manageCity'); ?>" class="btn btn-sm btn-primary pull-left">
                                    <i class="ace-icon fa fa-chevron-left"></i>
                                    Back
                                </a>
                                <button type="submit" class="btn btn-sm btn-primary">
                                    <i class="ace-icon fa fa-pencil"></i>
                                    Update
                                </button>
                            </div>
                        <?php echo form_close(); ?>
                    </div>
                </div>
                <!--USER DATA--->
                 <div class="row">
                    <div class="col-xs-12">
                        <h3 class="header smaller lighter blue">City Record</h3>

                        <div class="clearfix">
                            <div class="pull-right tableTools-container"></div>
                        </div>
                        <!-- div.table-responsive -->

                        <!-- div.dataTables_borderWrap -->
                        <div>
                            <table id="city_table" class="display" cellspacing="0" width="100%" >
                                <thead>
                                    <tr>
                                        
                                        <th class="center">Sr. No.</th>
                                        <th class="center">Name</th>
                                        <th class="center">Action</th>
                                    </tr>
                                </thead>

                                <tbody>
                                <?php 
                                $count = 0;
                                foreach ($cities as $city) 
                                {             
                                
                                ?>
                                    <tr>
                                        

                                        <td class="hidden-480 center">
                                            <?php echo $count++; ?>
                                        </td>
                                        <td class="hidden-480 center"><?php echo $city->name; ?></td>
                                        <td class="hidden-480 center">
                                            <div class="hidden-sm hidden-xs action-buttons">
                                            
                                                <a class="green" href="<?php echo base_url();?>City/updateCity/<?php echo $city->id; ?>" >
                                                    <i class="ace-icon fa fa-pencil bigger-130"></i>
                                                </a>

                                                <a class="red" href="<?php echo base_url();?>City/deleteCity/<?php echo $city->id; ?>">
                                                    <i class="ace-icon fa fa-trash-o bigger-130"></i>
                                                </a>
                                            </div>

                                            <div class="hidden-md hidden-lg">
                                                <div class="inline pos-rel">
                                                    <button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown" data-position="auto">
                                                        <i class="ace-icon fa fa-caret-down icon-only bigger-120"></i>
                                                    </button>

                                                    <ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close">
                                                        <li>
                                                            <a href="#" class="tooltip-info" data-rel="tooltip" title="View">
                                                                <span class="blue">
                                                                    <i class="ace-icon fa fa-search-plus bigger-120"></i>
                                                                </span>
                                                            </a>
                                                        </li>

                                                        <li>
                                                            <a href="#" class="tooltip-success" data-rel="tooltip" title="Edit">
                                                                <span class="green">
                                                                    <i class="ace-icon fa fa-pencil-square-o bigger-120"></i>
                                                                </span>
                                                            </a>
                                                        </li>

                                                        <li>
                                                            <a href="#" class="tooltip-error" data-rel="tooltip" title="Delete">
                                                                <span class="red">
                                                                    <i class="ace-icon fa fa-trash-o bigger-120"></i>
                                                                </span>
                                                            </a>
                                                        </li>
                                                    </ul>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                <?php } ?>
                                  

                                </tbody>
                                <tfoot>
                                    <tr>
                                        
                                        <th class="center">ID</th>
                                        <th class="center">Name</th>
                                        <th class="center">Action</th>
                                    </tr>
                                </tfoot>
                                
                            </table>
                        </div>
                    </div>

                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                 </div><!-- /.row -->
		</div><!-- PAGE CONTENT ENDS -->
        </div><!-- /.col -->
    </div><!-- /.row -->
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->

</div>

<?php $this->load->view('layout/footer'); ?>
