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

<head>

    <title>Career | 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(4)').html( $(this).find('td:eq(4)').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
                               $Career=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 Career</h3>
                        </div>
                        <br>
                        @if(!$Career)
                        <form action="admin_career" method="post" enctype="multipart/form-data">
                            @else
                            <form action="{{url('admin_career/update',array($Career->id))}}" method="post" enctype="multipart/form-data">
                            @endif
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label for="title">Title<i style="color: red">*</i></label>
                                        <input type="text" class="form-control" id="title" placeholder="Enter Title" name="title" value="<?php if($Career) {echo $Career->title;}?>" required>
                                        
                                    </div>

                                    <div class="form-group">
                                        <label for="title">Title 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 Title in Nepali" name="title_nepali" value="<?php if($Career) {echo $Career->title_nepali;}?>">
                                        
                                    </div>
                                    
                                    <div class="form-group">
                                        <label for="date">From Date<i style="color: red">*</i></label>
                                        <input type="date" class="form-control" id="date"  name="f_date" value="<?php if($Career) {echo $Career->f_date;}?>" required>
                                        
                                    </div>


                                     <div class="form-group">
                                        <label for="date">TO Date<i style="color: red">*</i></label>
                                        <input type="date" class="form-control" id="date"  name="t_date" value="<?php if($Career) {echo $Career->t_date;}?>" required>
                                        
                                    </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(!$Career)
                                        <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/Career/{{$Career->token}}.jpg?t={{rand()}}" width="250" height="150">
                                        </div>
                                        @endif
                                       
                                    </div>

                                    <div class="form-group">
                                        <label for="exampleTextarea">Description<i style="color: red">*</i></label>
                                        <textarea class="form-control ckeditor" id="exampleTextarea" rows="3" name="description"><?php if($Career) {echo $Career->description;}?></textarea>
                                    </div>

                                    <div class="form-group">
                                        <label for="exampleTextarea">Description in Nepali</label>
                                        <a rel="nofollow" href="http://naya.com.np" title="Nepali Social Network" class="naya_convert" data-site="dark"></a>
                                        <textarea class="form-control" id="exampleTextarea" rows="8" name="description_nepali"><?php if($Career) {echo $Career->description_nepali;}?></textarea>
                                    </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($Career){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%">Title</th>
                  <th width="20%">From Date</th>
                     <th width="20%">To Date</th>
                  
                  <th width="40%">Description</th>
                
                  
                  <th width="15%">Action</th>
                </tr>
                </thead>
                <tbody>
     
                  <tbody>
                  
                    <?php
                    echo AdminlogController::table_generator('careers',array('title','f_date','t_date','description'), 'admin_career','Career');?>
  
           
                </tbody>
               
              </table>
            </div>
            <!-- /.box-body -->
            </div>
          </div>
        </div>
    </div>

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

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

</html>
