Current File : //home/tradevaly/public_html/resources/views/user/pages/advertisment/renew.blade.php
@extends('user.ayaan.master')
@push('title','Renew Advertisment')

@section('title') Renew Advertisment@endsection
@push('style')

@endpush

@section('content')
<div class="container-fluid">
  <div class="row">
    <div class="col-md-12">
      <div class="card">
        <div class="card-header card-header-icon card-header-info">
          <div class="card-icon">
          </div>
          <h4 class="card-title">]Modify Your {{ $banner->position }}
          
          </h4>
        </div>
        <div class="card-body">
          <form action="{{ route('user.advertisment.renewUpdate',$banner->id)}}" method="POST" enctype="multipart/form-data">
              @csrf
              <div class="card" id="contact_section">
                            <div class="card-body">
                                @csrf
                                 <input type="hidden" name="link" value="https://www.tradevaly.com.bd/help"/>
                                <table class="table">
                                    <thead class=" ">
                                     <th>Placement</th>
                                     <th>Dymension</th>
                                     <th>Size</th>
                                     <th>Duration</th>
                                     <th>Banner Location</th>
                                     <th>Tariff In BDT</th>
                                     <th>action</th>
                                    </thead>
                                    <tbody>
                                      <tr>
                                        <td>Banner</td>
                                        
                                        <td>1920 x 332</td>
                                        <td>Max 5MB</td>
                                        <td>
                                            <select name="duration" id="" class="form-control duration_change" data-name="contact_banner"
                                            data-price="{{ settings()->contact_banner }}" data-after_price="{{ after_discount(settings()->contact_banner,settings()->contact_banner_discount) }}">
                                                <option value="1">1 Month</option>
                                                <option value="2">2 Months</option>
                                                <option value="3">3 Months</option>
                                                <option value="4">4 Months</option>
                                                <option value="5">5 Months</option>
                                                <option value="6">6 Months</option>
                                                <option value="7">7 Months</option>
                                                <option value="8">8 Months</option>
                                                <option value="9">9 Months</option>
                                                <option value="10">10 Months</option>
                                                <option value="11">11 Months</option>
                                                <option value="12">1 Year</option>
                                            </select>
                                        </td>
                                        <td><a target="_blank" href="https://www.tradevaly.com.bd/help">view Link</a></td>
                                         <td id="contact_banner">
                                             
                                             <!--<del>$ {{ settings()->contact_banner  }}</del>  ${{ after_discount(settings()->contact_banner,settings()->contact_banner_discount)  }}-->
                                            
                                           @if(settings()->contact_banner_discount != 0)  <del>Tk {{ settings()->contact_banner * settings()->bdt_rate  }}</del> @endif  Tk{{ after_discount(settings()->contact_banner,settings()->contact_banner_discount) * settings()->bdt_rate  }}
                                             
                                             </td>
                                        </tr>
                                    </tbody>
                                  </table>
                            </div>
                        </div>
            <div class="form-group mb-3">
                <div class="fileinput-new thumbnail mb-3">
                    <img src="{{asset('storage/images/admin/banner/'.$banner->image)}}" alt="{{$banner->alt}}" class='img-fluid'>
                  </div>
                  <div class="fileinput-preview fileinput-exists thumbnail"></div>
                  <div class="d-flex">
                    <span class=" btn-file">
                      <input type="file" name="image" />
                    </span>
                  </div>
             </div>
             
            <div class="form-group">
                  <input type="text" name="link" class="form-control" placeholder="Enter Your Link" value="{{$banner->link}}" required>
             </div>
             <br/>
            <button type="submit" class="btn btn-info pull-right">{{translate('Upload')}}</button>
            <a href="{{ route('user.advertisment.index')}}" class="btn btn-danger pull-right">Cancel</a>
            <div class="clearfix"></div>
            <span style="opacity:0;" id="bdt_rate" data-bdt_rate="{{ settings()->bdt_rate }}"></span>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
@stop

@push('script')
<script type="text/javascript">
   
    $(document).ready(function() {
         $('.duration_change').change(function(){
        let banner_name = $(this).data('name');
        let afterPrice = $(this).data('after_price');
        let banner_price = $(this).data('price');
        let duration = $(this).val();
       let className =  document.getElementById(banner_name);
       console.log(className,afterPrice,banner_price);
        afterPrice = afterPrice*duration
        banner_price = banner_price*duration
        
        let bdt_rate = $('#bdt_rate').data('bdt_rate');
        bdt_afterPrice = afterPrice*bdt_rate
        bdt_banner_price = banner_price*bdt_rate
        
        // import value in html
        className.innerHTML = `@if(settings()->top_banner_discount != 0)<del>Tk ${bdt_afterPrice} </del> @endif Tk ${bdt_banner_price}  `;
    })
       
    });
</script>
@endpush