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

<head>

    <title>Board of Director | 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>
     <script>
        
        $(document).ready(function(){
            
            
            $('table > tbody  > tr').each(function() {
        $(this).find('td:eq(3)').html( $(this).find('td:eq(3)').html().replace(/(<([^>]+)>)/ig,"").substring(0,300));
        
            
            });
            
        });
    </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 Board of Director</h3>
                        </div>
                        <br>
                        @if(!$data)
                        <form action="admin_board_of_director" method="post" enctype="multipart/form-data">
                            @else
                            <form action="{{url('admin_board_of_director/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 of BOD<i style="color: red">*</i></label>
                                        <SELECT class="form-control" id="type" name="member_type">
                                          <option value="Board Member" <?php if($data) echo AdminlogController::IsSelected($data->member_type,'Board Member');?>>Board Member</option>
                                          <option value="Account Supervisiory Committee" <?php if($data) echo AdminlogController::IsSelected($data->member_type,'Account Supervisiory Committee');?>>Account Supervisiory Committee</option>
                                         <option value="Advisor" <?php if($data) echo AdminlogController::IsSelected($data->member_type,'Advisor');?>>Advisor</option>
                                         

                                          <option value="Loan Management Sub-Committee" <?php if($data) echo AdminlogController::IsSelected($data->member_type,'Loan Management Sub-Committee');?>>Loan Management Sub-Committee</option>

                                          <option value="Education Sub-Committee" <?php if($data) echo AdminlogController::IsSelected($data->member_type,'Education Sub-Committee');?>>Education Sub-Committee</option>

                                          <option value="Microfinance Sub-Committee" <?php if($data) echo AdminlogController::IsSelected($data->member_type,'Microfinance Sub-Committee');?>>Microfinance Sub-Committee</option>

                                          <option value="Woman Development Sub-Committee" <?php if($data) echo AdminlogController::IsSelected($data->member_type,'Woman Development Sub-Committee');?>>Woman Development Sub-Committee</option>




                                        </SELECT>


                                        
                                    </div>
                                    <div class="form-group">
                                        <label for="title">Name<i style="color: red">*</i></label>
                                        <input type="text" class="form-control" id="title" placeholder="Enter Name" name="name" value="<?php if($data) {echo $data->name;}?>" required>
                                        
                                    </div>

                                    <div class="form-group">
                                        <label for="title">Name 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" placeholder="Enter Name in Nepali" name="name_nepali" value="<?php if($data) {echo $data->name_nepali;}?>">
                                        
                                    </div>

                              


                                    <div class="form-group">
                                        <label for="exampleInputFile">Image<i style="color: red">*</i> <i style="margin-left: 20px; font-size: 10px;">single image</i></label>
                                        @if(!$data)
                                        <input type="file" class="form-control-file" id="exampleInputFile" name="image" required>
                                        @else
                                        <input type="file" class="form-control-file" id="exampleInputFile" name="image" >
                                        <br>
                                        <div class="form-group">
                                            <img src="img/BOD/{{$data->token}}.jpg?t={{rand()}}" width="250" height="150">
                                        </div>
                                        @endif
                                       
                                    </div>  

                                    <div class="form-group">
                                        <label for="title">Post<i style="color: red">*</i></label>
                                        <input type="text" class="form-control" id="title" placeholder="Enter Post" name="post" value="<?php if($data) {echo $data->post;}?>" required>
                                        
                                    </div>

                                    <div class="form-group">
                                        <label for="title">Post 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" placeholder="Enter Post in Nepali" name="post_nepali" value="<?php if($data) {echo $data->post_nepali;}?>">
                                        
                                    </div> 

                                    <div class="form-group">
                                        <label for="title">Position Order</label>
                                        <input type="number" class="form-control" id="title" placeholder="Enter Position Order" name="position_order" value="<?php if($data) {echo $data->position_order;}?>">
                                        
                                    </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-md-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="20%">Member Type</th>
                  <th width="20%">Name</th>
                  
                  <th width="20%">Post</th>
                  <th width="20%">Position Order</th>
                  
                  <th width="15%">Action</th>
                </tr>
                </thead>
                <tbody>
     
                  <tbody>
                  
                    <?php
                    echo AdminlogController::table_generator('board_of_directors',array('member_type','name','post', 'position_order'), 'admin_board_of_director','BOD');?>
  
           
                </tbody>
               
              </table>
            </div>
            <!-- /.box-body -->
            </div>
          </div>
        </div>
    </div>

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

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

</html>
