<?php $__env->startSection('content'); ?>

 <section class="inner_header">
        <div class="container">
            <div class="top">
                <a href="<?php echo e(url(getCurrentLocale().'/')); ?>"><?php echo e(__('web.home')); ?> </a>
                <span><?php echo e(__('web.package')); ?></span>
            </div>
            <h2><?php echo e(__('web.package')); ?></h2>
        </div>
    </section>
    <main>
        <!-- -------------- register --------------- -->
        <section class="payment section-padding">
            <div class="container">
                <div class="head mb-3">
                    <h6><?php echo e(__('web.selectpackage')); ?></h6>
                </div>
                <div class="content">
                    <div class="row">
                        <div class="col-lg-4">
                            <div class="items bronz">
                                <div class="top text-center">
                                    <h5><?php echo e(packagename($first->id)); ?> </h5>
                                    <h2><?php echo e($first->cost); ?> <small>SAR </small></h2>
                                </div>
                                <div class="btm">
                                    <ul>
                                        <?php echo packagedescription($first->id); ?>

                                    </ul>
                                    <div class="shad_btn text-center col-12">
                                        <form  <?php if(\Auth::user()): ?> action="<?php echo e(url(getCurrentLocale().'/package')); ?>" <?php else: ?> onsubmit="loginft(this)" <?php endif; ?> method="post">
                                            <?php echo csrf_field(); ?>
                                        <input type="hidden" name="package_id" value="<?php echo e($first->id); ?>">
                                        <button class="butn" ><span><?php if(subscribed(1)): ?> <?php echo e(__('web.subscribed')); ?> <?php else: ?> <?php echo e(__('web.subscribe')); ?> <?php endif; ?></span></button>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div class="items gold">
                                <div class="top text-center">
                                    <h5><?php echo e(packagename($second->id)); ?> </h5>
                                    <h2> <small><?php echo e(__('web.yearly')); ?>  / </small> <?php echo e($second->cost); ?> <small><?php echo e(__('web.sar')); ?> </small></h2>
                                </div>
                                <div class="btm">
                                    <ul>
                                        <?php echo packagedescription($second->id); ?>

                                    </ul>
                                    <div class="shad_btn text-center col-12">
                                        <button class="butn" <?php if(\Auth::user()): ?> data-toggle="modal" data-target="#exampleModal1" <?php else: ?> data-toggle="modal" data-target="#modal_login" <?php endif; ?>><span><?php if(subscribed(2)): ?> <?php echo e(__('web.subscribed')); ?> <?php else: ?> <?php echo e(__('web.subscribe')); ?> <?php endif; ?></span></button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <div class="col-lg-4">
                            <div class="items plt">
                                <div class="top text-center">
                                    <h5><?php echo e(packagename($third->id)); ?></h5>
                                    <h2> <small><?php echo e(__('web.yearly')); ?>  / </small> <?php echo e($third->cost); ?> <small><?php echo e(__('web.sar')); ?> </small></h2>
                                </div>
                                <div class="btm">
                                    <ul>
                                         <?php echo packagedescription($third->id); ?>

                                    </ul>
                                    <div class="shad_btn text-center col-12">
                                        <button class="butn main_bg" <?php if(\Auth::user()): ?> data-toggle="modal" data-target="#exampleModal1plat" <?php else: ?> data-toggle="modal" data-target="#modal_login" <?php endif; ?>><span><?php if(subscribed(3)): ?> <?php echo e(__('web.subscribed')); ?> <?php else: ?> <?php echo e(__('web.subscribe')); ?> <?php endif; ?></span></button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- Modal -->
            <div class="modal modal_pay fade" id="exampleModal1" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
                <div class="modal-dialog modal-dialog-centered modal-xl">
                    <div class="modal-content">
                         <form onsubmit="paypackage(this)" data-id="2" action="<?php echo e(url(getCurrentLocale().'/package')); ?>" method="post">
                                            <?php echo csrf_field(); ?>
                                        <input type="hidden" name="package_id" value="<?php echo e($second->id); ?>">
                                        
                        <div class="modal-header">
                            <h5 class="modal-title" id="exampleModalLabel"> <?php echo e(__('web.pay')); ?> </h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                        </div>
                        <div class="modal-body">
                            <div class="pay_check">
                                <div class="hed">
                                    <h4><?php echo e(__('web.packagetype')); ?> : <span><?php echo e(packagename($second->id)); ?></span></h4>
                                </div>
                                <ul>
                                   <?php echo packagedescription($second->id); ?>

                                </ul>
                                
                                <div class="copon">
                                    <label> <?php echo e(__('web.addcobon')); ?> </label>
                                    <input onchange="copondata(this)"name="code" data-id="2" type="text" placeholder="<?php echo e(__('web.addcobon')); ?>">
                                    <div id="copon2"></div>
                                    <!-- <h6>السعر بعد الخصم <strong> 50 ريال</strong> </h6>   -->
                                </div>
                            </div>
                            <div class="pay-selection">
                                
                                 <?php $__currentLoopData = $ways; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                      <label>
                                <input type="radio" name="pay_type" onclick="showgolddata(this)" value="<?php echo e($row['PaymentMethodId']); ?>" class="time-input-element" />
                                  <div class="panel panel-default time-input">
                                    <div class="panel-heading">
                                        <img src="<?php echo e($row['ImageUrl']); ?>">
                                    </div>
                                  </div>
                            </label>
                                       
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
   <label>
                                <input type="radio" name="pay_type" onclick="hidegolddata(this)" value="wallet" class="time-input-element" />
                                  <div class="panel panel-default time-input">
                                    <div class="panel-heading">
                                        <img src="<?php echo e(url('')); ?>/assets/web/images/pay/wallet.png">
                                    </div>
                                  </div>
                            </label>
                            </div>
                           <div class="credit_info">
                       
                        <!------------- new ------------>
                        <div class="pay_check">
                                    <div class="copon">
                                        <div id="successpay2" style="display : none" class="alert alert-success">-->

                        </div>
                       <div id="errorpay2" style="display : none" class="alert alert-danger">

                    </div>
                                        <!-- <h5>تفاصيل الكارت </h5> -->
                                        <div id="showcreditgold">
                                        <div class="row" >
                                            <div class="col-lg-6">
                                                <div class="form-group">
                                                    <label> <?php echo e(__('web.credit')); ?>  </label>
                                                    <input type="text"  name="credit" placeholder="<?php echo e(__('web.credit')); ?> ">
                                                </div>
                                            </div>
                                            <div class="col-lg-6">
                                                <div class="form-group">
                                                    <label> <?php echo e(__('web.cvv')); ?>  </label>
                                                    <input type="text"  name="cvv" placeholder="<?php echo e(__('web.cvv')); ?>  ">
                                                </div>
                                            </div>
                                              <div class="col-lg-6">
                                                <div class="form-group">
                                                    <label> <?php echo e(__('web.name')); ?>  </label>
                                                    <input type="text" name="fullname" placeholder="<?php echo e(__('web.name')); ?>  ">
                                                </div>
                                            </div>
                                           
                                            <div class="col-lg-6">
                                                <div class="form-group">
                                                    <label> <?php echo e(__('web.month')); ?>   </label>
                                                    <input type="number" max="12" name="month" placeholder=" <?php echo e(__('web.month')); ?> ">
                                                </div>
                                            </div>
                                            <div class="col-lg-6">
                                                <div class="form-group">
                                                    <label> <?php echo e(__('web.year')); ?>  </label>
                                                    <input type="number" max="99" name="year" placeholder=" <?php echo e(__('web.year')); ?> ">
                                                </div>
                                            </div>
                                        </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        
                        
                      
                        </div>
                        <div class="modal-footer justify-content-center">
                            <button type="submit" class="butn main_bg"><span><?php echo e(__('web.pay')); ?></span> </button>
                        </div>
                        </form>
                    </div>
                </div>
            </div>
            <div class="modal modal_pay fade" id="exampleModal1plat" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
                <div class="modal-dialog modal-dialog-centered modal-xl">
                    <div class="modal-content">
                         <form onsubmit="paypackage(this)" data-id="3" action="<?php echo e(url(getCurrentLocale().'/package')); ?>" method="post">
                                            <?php echo csrf_field(); ?>
                                        <input type="hidden" name="package_id" value="<?php echo e($third->id); ?>">
                                          
                        <div class="modal-header">
                            <h5 class="modal-title" id="exampleModalLabel"> <?php echo e(__('web.pay')); ?> </h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                        </div>
                        <div class="modal-body">
                            <div class="pay_check">
                                <div class="hed">
                                    <h4><?php echo e(__('web.packagetype')); ?> : <span> <?php echo e(packagename($third->id)); ?> </span></h4>
                                </div>
                                <ul>
                                  <?php echo packagedescription($third->id); ?>

                                </ul>
                                
                                <div class="copon">
                                    <label> <?php echo e(__('web.addcobon')); ?> </label>
                                    <input onchange="copondata(this)" name="code" data-id="3" type="text" placeholder="<?php echo e(__('web.addcobon')); ?>">
                                    <div id="copon3"></div>
                                </div>
                            </div>
                            <div class="pay-selection">
                                  <?php $__currentLoopData = $ways; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                      <label>
                                <input type="radio" name="pay_type" onclick="showplatdata(this)" value="<?php echo e($row['PaymentMethodId']); ?>" class="time-input-element" />
                                  <div class="panel panel-default time-input">
                                    <div class="panel-heading">
                                        <img src="<?php echo e($row['ImageUrl']); ?>">
                                    </div>
                                  </div>
                            </label>
                                       
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                <label>
                                <input type="radio" name="pay_type" onclick="hideplatdata(this)" value="wallet" class="time-input-element" />
                                  <div class="panel panel-default time-input">
                                    <div class="panel-heading">
                                        <img src="<?php echo e(url('')); ?>/assets/web/images/pay/wallet.png">
                                    </div>
                                  </div>
                            </label>
                                

                            </div>
                            <div class="credit_info">
                               <div class="pay_check">
                                    <div class="copon">
                                        <div id="successpay3" style="display : none" class="alert alert-success">-->

                        </div>
                       <div id="errorpay3" style="display : none" class="alert alert-danger">

                    </div>
                                        <!-- <h5>تفاصيل الكارت </h5> -->
                                        <div id="showcreditplat">
                                        <div class="row" >
                                            <div class="col-lg-6">
                                                <div class="form-group">
                                                    <label> <?php echo e(__('web.credit')); ?>  </label>
                                                    <input type="text"  name="credit" placeholder="<?php echo e(__('web.credit')); ?>  ">
                                                </div>
                                            </div>
                                            <div class="col-lg-6">
                                                <div class="form-group">
                                                    <label> <?php echo e(__('web.cvv')); ?>  </label>
                                                    <input type="text"  name="cvv" placeholder="<?php echo e(__('web.cvv')); ?>  ">
                                                </div>
                                            </div>
                                              <div class="col-lg-6">
                                                <div class="form-group">
                                                    <label> <?php echo e(__('web.name')); ?> </label>
                                                    <input type="text" name="fullname" placeholder="<?php echo e(__('web.name')); ?> ">
                                                </div>
                                            </div>
                                           
                                            <div class="col-lg-6">
                                                <div class="form-group">
                                                    <label> <?php echo e(__('web.month')); ?>   </label>
                                                    <input type="number" max="12" name="month" placeholder="<?php echo e(__('web.month')); ?> ">
                                                </div>
                                            </div>
                                            <div class="col-lg-6">
                                                <div class="form-group">
                                                    <label> <?php echo e(__('web.year')); ?>  </label>
                                                    <input type="number" max="99" name="year" placeholder="<?php echo e(__('web.year')); ?> ">
                                                </div>
                                            </div>
                                        </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer justify-content-center">
                            <button type="submit" class="butn main_bg"><span><?php echo e(__('web.pay')); ?> </span> </button>
                        </div>
                        </form>
                    </div>
                </div>
            </div>
        </section>

        <!-- -------------- inner_subscribe --------------- -->
        <section class="inner_subscribe">
            <div class="container">
                <div class="row">
                    <div class="col-lg-6">
                        <div class="r_side">
                            <div class="icons">
                                <i class="fas fa-location-arrow"></i>
                            </div>
                            <div class="info">
                                <h6><?php echo e(__('web.sub_mail')); ?></h6>
                                <p><?php echo e(__('web.sub_mail_desc')); ?></p>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-6">
                        <div class="l_side">
                            <form onsubmit="subscribedata(this)" method="post" action="<?php echo e(url(getCurrentLocale().'/subcribe')); ?>" class="form-row">
                                <?php echo csrf_field(); ?>
                                <div class="form-group col-12">
                                    <input type="email" name="email"  placeholder="<?php echo e(__('web.email')); ?>">
                                    <button><?php echo e(__('web.subscribe')); ?></button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
                <div class="modal fade modal_login" id="mailsuccess" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-body text-center">
                        <div class="icon">
                            <img src="<?php echo e(url('')); ?>/assets/web/images/icons/checked.svg" alt="">
                        </div>
                        <h4><?php echo e(__('web.success')); ?> </h4>
                    </div>
                </div>
            </div>
        </div>
         <div class="modal fade modal_login" id="modal_login" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-body text-center">
                        <div class="icon">
                            <img src="<?php echo e(url('')); ?>/assets/web/images/icons/alert.svg" alt="">
                        </div>
                        <h4><?php echo e(__('web.loginfs')); ?> </h4>
                        <a href="#" class="butn bg-danger text-white m-1" data-dismiss="modal"><span><?php echo e(__('web.close')); ?> </span></a>
                        <a href="<?php echo e(url(getCurrentLocale().'/login')); ?>" class="butn main_bg m-1"><span><?php echo e(__('web.login')); ?> </span></a>
                    </div>
                </div>
            </div>
        </div>
         <div class="modal fade modal_login" id="mailfailed" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-body text-center">
                        <div class="icon">
                            <img src="<?php echo e(url('')); ?>/assets/web/images/icons/alert.svg" alt="">
                        </div>
                        <div id="mailerrors" class="alert alert-danger">
                             
                        </div>
                       
                        
                    </div>
                </div>
            </div>
        </div>
        </section>



    </main>
  <?php $__env->startPush('js'); ?>
<script>
function paypackage(elem){
   event.preventDefault();
         let action = $(elem).attr('action');
       
       let urls = action;
       let target = $(elem).attr('data-id');
       let dataform = new FormData( $(elem)[0]);
        
     
      $.ajax({
          url : urls,
          type: 'POST',              
          data: dataform,
          contentType: false, 
          processData: false, 
          dataType : 'json',
          success:function(data)
          {
            if(data == 'success'){
            $('#errorpay'+target).css("display", "none");
              $('#successpay'+target).css("display", "block");
            $('#successpay'+target).html(<?php echo json_encode(__('web.success')); ?>);

           setTimeout(
  function()
  {
      window.location.replace("<?php echo e(url(getCurrentLocale().'/profile/')); ?>");
  }, 1000);
            }
            else{
                $('#successpay'+target).css("display", "none");
              $('#errorpay'+target).html('');
    $('#errorpay'+target).css("display", "block");
                $('#errorpay'+target).append('<div class="col-12">'+data+'</div');
            }
  
               }
          ,error: function (data) {
              
               $('#successpay'+target).css("display", "none");
              $('#errorpay'+target).html('');
    $('#errorpay'+target).css("display", "block");

   $.each(data.responseJSON.errors, function(key,value) {

     $('#errorpay'+target).append('<div class="col-12">'+value+'</div');


 });

}
        })

}
    function subscribedata(elem) {
    event.preventDefault();
   
         let action = $(elem).attr('action');
       
       let urls = action;
       
       let dataform = new FormData( $(elem)[0]);
        
     
      $.ajax({
          url : urls,
          type: 'POST',              
          data: dataform,
          contentType: false, 
          processData: false, 
          success:function(data)
          {
            
            $("#mailsuccess").modal('show');
               }
          ,error: function (data) {
              
              $('#mailerrors').html('');
   $.each(data.responseJSON.errors, function(key,value) {
      
     $('#mailerrors').append('<h4 >'+value+'</h4>');
     
 }); 
 
  $("#mailfailed").modal('show');
 
}
        })


}
function copondata(elem){
    let num = $(elem).attr('data-id');
    let code = $(elem).val();
    
      $.ajax({
          url : <?php echo json_encode(url(getCurrentLocale().'/copondata')); ?>+'/'+num+','+code,
          type: 'GET',              
          dataType :'json',
          success:function(data)
          {
            if(data != 'error'){
            $("#copon"+num).html('<h6>'+<?php echo json_encode(__('web.costafter')); ?>+' <strong> '+data+' '+<?php echo json_encode(__('web.sar')); ?>+'</strong> </h6>');
            
               }
               else{
                   $("#copon"+num).html(<?php echo json_encode(__('web.errorcopon')); ?>);
               }
          }
        })
}
function loginft(elem){
      event.preventDefault();
      $('#modal_login').modal('show');
}
function hidegolddata(elem){
    $('#showcreditgold').css('display','none');
}

function showgolddata(elem){
    $('#showcreditgold').css('display','block');
}
function hideplatdata(elem){
    $('#showcreditplat').css('display','none');
}

function showplatdata(elem){
    $('#showcreditplat').css('display','block');
}
</script>
<?php $__env->stopPush(); ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('web.layouts.main', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/omaralyomhost/public_html/hanqr/resources/views/web/pages/package.blade.php ENDPATH**/ ?>