<?php namespace App\Http\Controllers;?>
<!DOCTYPE html>
<html>

<head>

    <title>Interest Rate | Admin |  Samuhik Saving & Co-Operative Society Ltd.</title>
    @include('Admin.Parts.MetaCSS')
    <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
     
</head>

<body>

<!--====================================================
                     MAIN NAVBAR
======================================================-->
    @include('Admin.Parts.TopHeader')

<!--====================================================
                    PAGE CONTENT
======================================================-->
    <div class="page-content d-flex align-items-stretch">

        <!--***** SIDE NAVBAR *****-->
        @include('Admin.Parts.LeftNav')

        <div class="content-inner form-cont">
            <div class="row">
                <div class="col-md-12">
                    <div class="row">
                        <div class="col-md-6 col-lg-6">
                           @if (session('info'))
                           <div class="alert alert-success" style="text-transform: capitalize;">
                              {{session('info')}}
                           </div>
                           @endif
                           @php
                               $data=session('avisd');
                           @endphp
                           @if ($errors->any())
                           <div class="alert alert-danger">
                              <ul>
                                 @foreach ($errors->all() as $error)
                                 <li>{{ $error }}</li>
                                 @endforeach
                              </ul>
                           </div>
                           @endif
                        </div>
                     </div>
                    <div class="card form" id="form1">
                        <div class="card-header">
                            <h3>Add Interest Rate</h3>
                        </div>
                        <br>
                        @if(!$data)
                        <form action="admin_ir" method="post" enctype="multipart/form-data">
                            @else
                            <form action="{{url('admin_ir/update',array($data->id))}}" method="post" enctype="multipart/form-data">
                            @endif
                            <div class="row">
                                <div class="col-md-12">

                                  <div class="form-group">
                                        <label for="title">Type<i style="color: red">*</i></label>
                                        <SELECT class="form-control" id="type" name="type">
                                          <option value="Fixed Deposit" <?php if($data) echo AdminlogController::IsSelected($data->type,'Fixed Deposit');?>>Fixed Deposit</option>
                                          <option value="SIR" <?php if($data) echo AdminlogController::IsSelected($data->type,'Loan');?>>Saving and its Interest Rates</option>
                                          <option value="LIR" <?php if($data) echo AdminlogController::IsSelected($data->type,'LIR');?>>Loan and its Interest Rates</option>
                                         
                                        </SELECT> 
                                        
                                    </div>
                                    <div class="form-group">
                                        <label for="title">Product<i style="color: red">*</i></label>
                                        <input type="text" class="form-control" id="title"  name="product" placeholder="Enter Title" value="<?php if($data) {echo $data->product;}?>">
                                        
                                    </div>

                                    <div class="form-group">
                                        <label for="title">Product in Nepali</label>
                                        <a rel="nofollow" href="http://naya.com.np" title="Nepali Social Network" class="naya_convert" data-site="dark"></a>
                                        <input type="text" class="form-control" id="title"  name="product_nepali" placeholder="Enter Title in Nepali" value="<?php if($data) {echo $data->product_nepali;}?>">
                                        
                                    </div>
                                    
                                     <div class="form-group">
                                        <label for="title">Interest<i style="color: red">*</i></label>
                                        <input type="text" class="form-control"  placeholder="Enter Interest in Percentage"  name="interest_rate" value="<?php if($data) {echo $data->interest_rate;}?>">
                                        
                                    </div>
                                
                                    
                                </div>
                                
                            </div>
                            <input type="hidden" name="_token" value="{{csrf_token()}}">
                            
                            <button type="reset" class="btn btn-general btn-white">Cancel</button>

                            <button type="submit" class="btn btn-general btn-blue mr-2"><?php if($data){echo "Update";}else {echo "Save";}?></button>
                        </form>
                    </div>

       <div class="card form" id="form1">           
        <div class="row">
          <div class="col-xs-12">
            <div class="box">
              <div class="box-header">
                <h3 class="box-title">Data Table</h3>
              </div>
             <!-- /.box-header -->
             <div class="box-body" >
              <table id="example2" class="table table-bordered table-hover">
                <thead>
                  <tr>
                  <th width="5%">SN</th>
                  <th width="10%">Type</th>
                  <th width="10%">Product</th>
                  <th width="5%">Interest</th>
                
                  <th width="15%">Action</th>
                </tr>
                </thead>
                <tbody>
     
                  <tbody>
                  
                    <?php
                    echo AdminlogController::table_generator('irs',array('type','product','interest_rate'), 'admin_ir','Interest Rate');?>
  
           
                </tbody>
               
              </table>
            </div>
            <!-- /.box-body -->
            </div>
          </div>
        </div>
    </div>

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

@include('Admin.Parts.Js')
</body>

</html>
