<div class="content-wrapper" style="min-height: 946px;">
    <section class="content-header">
        <h1>
    <i class="fa fa-mortar-board"></i> Multi Currencies <small>Daily Rates</small>        </h1>
	
									 <a href="<?php  echo base_url(); ?>dailyrates/historyrates" class="col-md pull-right">History Rates</a>
								 <b style="padding-left:5px;padding-right:5px;"class="pull-right"> | </b>											 
								 <a href="<?php  echo base_url(); ?>dailyrates/" class="col-md pull-right">Set Daily Rates</a>
								 <b style="padding-left:5px;padding-right:5px;"class="pull-right"> | </b>
								 <a href="<?php  echo base_url(); ?>homecurrencies/" class="col-md pull-right">Home Currency</a>
								 <b style="padding-left:5px;padding-right:5px;"class="pull-right"> | </b>
								 <a href="<?php  echo base_url(); ?>internationalcurrencies/" class="col-md pull-right">Foreign Currency</a> 
								 <b style="padding-left:5px;padding-right:5px;"class="pull-right"> | </b>
								 <a href="<?php  echo base_url(); ?>currency/" class="col-md pull-right">Add Currency</a>
    </section>
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <?php
            if ($this->rbac->hasPrivilege('section', 'can_add')) {
                ?>
                <div class="col-md-4">
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">Edit Bank Rate</h3>
                        </div> 
				<?php  
				 foreach ($dailyrates->result() as $dep_row)  
				 {   
				?>						
                        <form action="<?php echo site_url('dailyrates/edit/' . $dep_row->id) ?>"  id="employeeform" name="employeeform" method="post" accept-charset="utf-8">
                            <div class="box-body">
                                <?php if ($this->session->flashdata('msg')) { ?>
                                    <?php echo $this->session->flashdata('msg') ?>
                                <?php } ?>  
                                <?php echo $this->customlib->getCSRF(); ?>                               
								<div class="form-group">
                                    <label for="exampleInputEmail1">Foreign Currency Code</label><small class="req"> *</small>                     
 										<select id="foreign_currency" name="foreign_currency" placeholder="" type="text" class="form-control" >
											<option><?php echo $dep_row->foreign_currency; ?></option>
											<?php 
												foreach ($foreignc->result() as $fc) {
												?>
									               <option value="<?php echo $fc->currencycode; ?>" >  <?php echo $fc->currencycode; ?></option>
											<?php }
											?>
										</select>                                  

								   <span class="text-danger"><?php echo form_error('foreign_currency'); ?></span>
                                </div>                               
								<div class="form-group">
                                    <label for="exampleInputEmail1">Home Currency Code</label><small class="req"> *</small>
                                       <select id="home_currency" name="home_currency" placeholder="" type="text" class="form-control" >
											<option><?php echo $dep_row->home_currency; ?></option>
											<?php 
												foreach ($homec->result() as $hc) {
												?>
									               <option value="<?php echo $hc->currencycode; ?>" >  <?php echo $hc->currencycode; ?></option>
											<?php }
											?>
										</select>                                      
									
									<span class="text-danger"><?php echo form_error('home_currency'); ?></span>
                                </div>                                
								<div class="form-group">
                                    <label for="exampleInputEmail1">Foreign Rate</label><small class="req"> *</small>
                                    <input autofocus="" id="foreign_rate" name="foreign_rate" placeholder="" type="text" class="form-control"  value="<?php echo $dep_row->foreign_rate; ?>" />
                                    <span class="text-danger"><?php echo form_error('foreign_rate'); ?></span>
                                </div>                                
								<div class="form-group">
                                    <label for="exampleInputEmail1">Home Rate</label><small class="req"> *</small>
                                    <input autofocus="" id="home_rate" name="home_rate" placeholder="" type="text" class="form-control"  value="<?php echo $dep_row->home_rate; ?>" />
                                    <span class="text-danger"><?php echo form_error('home_rate'); ?></span>
                                </div>                               
								<div class="form-group">
                                    <label for="exampleInputEmail1">Description</label><small class="req"> *</small>
                                    <input autofocus="" id="description" name="description" placeholder="" type="text" class="form-control"  value="<?php echo $dep_row->description; ?>" />
                                    <span class="text-danger"><?php echo form_error('description'); ?></span>
                                </div>
                            </div>
                            <div class="box-footer">
                                <button type="submit" class="btn btn-info pull-right"><?php echo $this->lang->line('save'); ?></button>
                            </div>
                        </form>
						<?php } ?>  
                    </div>  
                </div>   
            <?php } ?>  
            <div class="col-md-<?php
            if ($this->rbac->hasPrivilege('section', 'can_add')) {
                echo "8";
            } else {
                echo "12";
            }
            ?>">             
                <div class="box box-primary">
                    <div class="box-header ptbnull">
                        <h3 class="box-title titlefix">Bank Rates List</h3>
                    </div>
                    <div class="box-body ">
                        <div class="table-responsive mailbox-messages">
                            <div class="download_label">Bank Rate List</div>
                            <table class="table table-striped table-bordered table-hover example">
                                <thead>
                                    <tr>
                                        <th>Date Captured</th>
                                        <th>Foreign Currency</th>
                                        <th>Home Currency</th>
                                        <th>Foreign Rate</th>
                                        <th>Home Rate</th>
                                        <th>Description</th>
                                        <th class="text-right"><?php echo $this->lang->line('action'); ?></th>
                                    </tr>
                                </thead>
                                <tbody>                                   

                                    <?php
                                    $count = 1;
                                    foreach ($dailyrateslist->result() as $bankrate) {
                                        ?>
                                        <tr>
                                            <td class="mailbox-name"> <?php echo $bankrate->date; ?></td>
                                            <td class="mailbox-name"> <?php echo $bankrate->foreign_currency; ?></td>
                                            <td class="mailbox-name"> <?php echo $bankrate->home_currency; ?></td>
                                            <td class="mailbox-name"> <?php echo $bankrate->foreign_rate; ?></td>
                                            <td class="mailbox-name"> <?php echo $bankrate->home_rate; ?></td>
                                            <td class="mailbox-name"> <?php echo $bankrate->description; ?></td>
                                            <td class="mailbox-date pull-right">
                                                <?php
                                                if ($this->rbac->hasPrivilege('section', 'can_delete')) {
                                                    ?>
                                                    <a href="<?php echo base_url(); ?>dailyrates/delete/<?php echo $bankrate->id; ?>"class="btn btn-default btn-xs"  data-toggle="tooltip" title="<?php echo $this->lang->line('delete'); ?>" onclick="return confirm('<?php echo $this->lang->line('delete_confirm') ?>');">
                                                        <i class="fa fa-remove"></i>
                                                    </a>
                                                <?php } ?>
                                            </td>
                                        </tr>
                                        <?php
                                    }
                                    $count++;
                                    ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div> 

        </div> 
    </section>
</div>