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

    <div class="page-heading">
        <div class="bread">
            <h4><?php echo e(__('web.profile')); ?></h4>
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="<?php echo e(url(getCurrentLocale().'/')); ?>"><?php echo e(__('web.home')); ?></a></li>
                <li class="breadcrumb-item active" aria-current="page"><?php echo e(__('web.profile')); ?></li>
                </ol>
            </nav>
        </div>
    </div>  
    <main>
        <!--Start profile-pg -->
        <section class="profile-pg">
            <div class="container">
                  <?php $__currentLoopData = $ends; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
   <div class="col-12">
    <div  class="alert alert-primary">
<p style="color: black;"><?php echo e(__('web.subscribe_expired')); ?> <a style="text-decoration: underline;color:#cb2262" href="<?php echo e(url(getCurrentLocale().'/pay/package/'.$row->package_id)); ?>">( <?php echo e(sectionname($row->package->section_id)); ?> : <?php echo e(packagename($row->package_id)); ?> )</a> <a style="text-decoration: underline;color:#cb2262" href="<?php echo e(url(getCurrentLocale().'/package')); ?>"><?php echo e(__('web.subscribe_again')); ?></a></p>
</div>
</div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                <div class="inner">
                   
                    <div class="row">
                        
                        <div class="col-lg-4">
                            <div class="side-nav">
                                <div class="profile-info">
                                    <img src="<?php echo e(asset($user->photo)); ?>" alt="" class="avatar">
                                    <div class="text-box">
                                        <h6 class="name"><?php echo e($user->name); ?></h6>
                                        <p class="email"><?php echo e($user->email); ?></p>
                                    </div>
                                </div>
                                <div class="nav flex-column nav-pills mt-5" id="v-pills-tab" role="tablist" aria-orientation="vertical">
                                    <a class="nav-link active" id="v-pills-tab1-tab" data-toggle="pill" href="#v-pills-tab1" role="tab" aria-controls="v-pills-tab1" aria-selected="true"><?php echo e(__('web.personal_info')); ?></a>
                                    <a class="nav-link" id="v-pills-tab2-tab" data-toggle="pill" href="#v-pills-tab2" role="tab" aria-controls="v-pills-tab2" aria-selected="false"><?php echo e(__('web.package')); ?></a>
                                    <a class="nav-link" id="v-pills-tab3-tab" data-toggle="pill" href="#v-pills-tab3" role="tab" aria-controls="v-pills-tab3" aria-selected="false"><?php echo e(__('web.notifications')); ?></a>
                                    <a class="nav-link" href="<?php echo e(url(getCurrentLocale().'/logout')); ?>"><?php echo e(__('web.logout')); ?></a>
                                </div>
                                <img src="<?php echo e(url('')); ?>/assets/web/images/nawal-pattern.png" alt="" class="pattern">
                            </div>
                        </div>
                        <div class="col-lg-8">
                            <div class="tab-content" id="v-pills-tabContent">
                                <div class="tab-pane fade show active" id="v-pills-tab1" role="tabpanel" aria-labelledby="v-pills-tab1-tab">
                                    <div class="tab-wrapper info">
                                        <h4 class="tab-title"><?php echo e(__('web.personalinfo')); ?></h4>
                                        <div class="row">
                                            <div class="col-md-7 m-auto">
                                                <div class="data-group">
                                                    <p class="label"><?php echo e(__('web.name')); ?></p>
                                                    <p class="data"><?php echo e($user->name); ?></p>
                                                </div>
                                                <div class="data-group">
                                                    <p class="label"><?php echo e(__('web.email')); ?></p>
                                                    <p class="data"><?php echo e($user->email); ?></p>
                                                </div>
                                                <div class="data-group">
                                                    <p class="label"><?php echo e(__('web.phone')); ?></p>
                                                    <p class="data"><?php if(!is_null($user->country_id)): ?>+<?php echo e($user->country->key); ?> <?php endif; ?>-<?php echo e($user->phone); ?></p>
                                                </div>
                                                <div class="data-group">
                                                    <p class="label"><?php echo e(__('web.gender')); ?></p>
                                                    <p class="data"><?php if($user->gender == '1'): ?> <?php echo e(__('web.male')); ?> <?php else: ?> <?php echo e(__('web.female')); ?> <?php endif; ?></p>
                                                </div>
                                                <div class="data-group">
                                                    <p class="label"><?php echo e(__('web.tall')); ?></p>
                                                    <p class="data"><?php echo e($user->tall); ?> <?php echo e(tallname($user->tall_id)); ?></p>
                                                </div>
                                                <div class="data-group">
                                                    <p class="label"><?php echo e(__('web.weight')); ?></p>
                                                    <p class="data"><?php echo e($user->weight); ?> <?php echo e(tallname($user->weight_id)); ?></p>
                                                </div>
                                                <div class="data-group">
                                                    <p class="label"><?php echo e(__('web.date_of_birth')); ?>د</p>
                                                    <p class="data"><?php echo e($user->date_of_birth); ?></p>
                                                </div>
                                                <button class="main-butn mt-5" type="button"  data-toggle="modal" data-target="#infoModal"><span>تعديل البيانات</span></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="tab-pane fade" id="v-pills-tab2" role="tabpanel" aria-labelledby="v-pills-tab2-tab">
                                    <div class="tab-wrapper package-tab">
                                        <h4 class="tab-title"><?php echo e(__('web.packages')); ?></h4>
                                        <div class="row">
                                            <?php if(count($subs) > 0): ?>
                                            <?php $__currentLoopData = $subs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php if($row->type == 0): ?>
                                            <?php if($row->active == '1'): ?>
                                            <div class="col-lg-6 m-auto">
                                                <div class="pcg_card ">
                                                    <div class="pcg_head">
                                                        <h3 class="name"><?php echo e(sectionname(sectiobpackage($row->package_id))); ?></h3>
                                                        <p class="name"><?php echo e(packagename($row->package_id)); ?></p>
                                                        <h2 class="price "><b><?php echo e(package($row->package_id)['cost']); ?></b> <small><?php echo e(__('web.sar')); ?></small></h2>
                                                        <div class="plan-period">
                                                            <div class="content">
                                                                <p class="label"><?php echo e(__('web.start_date')); ?></p>
                                                                <p class="data"><?php echo e(date('Y-m-d', strtotime(subscribe($row->id)['date']))); ?></p>
                                                            </div>
                                                            <div class="content">
                                                                <p class="label"><?php echo e(__('web.end_date')); ?></p>
                                                                <?php $end = package($row->package_id)['length']; ?>
                                                                <p class="data"><?php echo e(date('Y-m-d', strtotime(subscribe($row->id)['date']. " + $end days"))); ?></p>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="card-body">
                                                        <div class="row">
                                                            <div class="col-6">
                                                                <p class="label"><?php echo e(__('web.consults')); ?></p>
                                                            </div>
                                                            <div class="col-6">
                                                                <p class="data"><?php echo e(consultpackage($row->package_id)); ?></p>
                                                            </div>
                                                            <?php $__currentLoopData = items($row->package_id); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                            <div class="col-6">
                                                                <p class="label"><?php echo e(itemkey($item->id)); ?></p>
                                                            </div>
                                                            <div class="col-6">
                                                                <p class="data"><?php echo e(itemvalue($item->id)); ?></p>
                                                            </div>
                                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                        </div>
                                                        <div class="btns-wrapper">
                                                            <a href="<?php echo e(url(getCurrentLocale().'/subscribe/'.$row->id)); ?>" class="main-butnn"><span> <?php echo e(__('web.details')); ?> </span></a>
                                                            <a href="<?php echo e(url(getCurrentLocale().'/package')); ?>" class="main-butnn solid-butn"><span> <?php echo e(__('web.upgrade')); ?> </span></a>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <?php endif; ?>
                                            <?php else: ?>
                                            <div class="col-lg-6 m-auto">
                                                <div class="pcg_card">
                                                    <div class="pcg_head">
                                                        <h3 class="name"><?php echo e(sectionname(sectiobpackage($row->package_id))); ?></h3>
                                                        <p class="name"><?php echo e(packagename($row->package_id)); ?></p>
                                                        <h2 class="price "><b><?php echo e(package($row->package_id)['cost']); ?></b> <small><?php echo e(__('web.sar')); ?></small></h2>
                                                        <div class="plan-period">
                                                            <div class="content">
                                                                <p class="label"><?php echo e(__('web.start_date')); ?></p>
                                                                <p class="data"><?php echo e(date('Y-m-d', strtotime(subscribe($row->id)['date']))); ?></p>
                                                            </div>
                                                            <div class="content">
                                                                <p class="label"><?php echo e(__('web.end_date')); ?></p>
                                                                <?php $end = package($row->package_id)['length']; ?>
                                                                <p class="data"><?php echo e(date('Y-m-d', strtotime(subscribe($row->id)['date']. " + $end days"))); ?></p>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="card-body">
                                                        <div class="row">
                                                             <div class="col-6">
                                                                <p class="label"><?php echo e(__('web.consults')); ?></p>
                                                            </div>
                                                            <div class="col-6">
                                                                <p class="data"><?php echo e(consultpackage($row->package_id)); ?></p>
                                                            </div>
                                                            <?php $__currentLoopData = items($row->package_id); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                            <div class="col-6">
                                                                <p class="label"><?php echo e(itemkey($item->id)); ?></p>
                                                            </div>
                                                            <div class="col-6">
                                                                <p class="data"><?php echo e(itemvalue($item->id)); ?></p>
                                                            </div>
                                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                        </div>
                                                        <div class="btns-wrapper">
                                                            <a href="<?php echo e(url(getCurrentLocale().'/subscribe/'.$row->id)); ?>" class="main-butnn"><span> <?php echo e(__('web.details')); ?> </span></a>
                                                            <a href="<?php echo e(url(getCurrentLocale().'/package')); ?>" class="main-butnn solid-butn"><span> <?php echo e(__('web.upgrade')); ?> </span></a>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <?php endif; ?>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                             <?php else: ?>
                                         <h5 class="tab-title"> <?php echo e(__('web.notexistsubs')); ?> </h5>
                                        <?php endif; ?>
                                        </div>
                                    </div>
                                </div>
                                <div class="tab-pane fade" id="v-pills-tab3" role="tabpanel" aria-labelledby="v-pills-tab3-tab">
                                    <div class="tab-wrapper notifications">
                                        <h4 class="tab-title"> <?php echo e(__('web.notifications')); ?> </h4>
                                        <?php if(count($notifications) > 0): ?>
                                        <?php $__currentLoopData = $notifications; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <div class="noti_item">
                                            <p class="date "><?php echo e(date('Y-m-d g:i a',strtotime($row->created_at))); ?></p>
                                            <div class="content">
                                                <img src="<?php echo e(url('')); ?>/assets/web/images/icons/notification.svg" alt="" class="icon">
                                                <div class="text-box">
                                                    <h5 class="title"><?php echo e(notificationname($row->id)); ?></h5>
                                                    <div>
                                                        <?php echo notificationdescription($row->id); ?>

                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        <?php else: ?>
                                         <h5 class="tab-title"> <?php echo e(__('web.notexistnotifications')); ?> </h5>
                                        <?php endif; ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!--Info Modal-->
        <div class="modal info-modal fade" id="infoModal" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="staticBackdropLabel"><?php echo e(__('web.editprofile')); ?></h5><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                    </div>
                    <form onsubmit="savechange(this)" method="post" action="<?php echo e(url(getCurrentLocale().'/editprofile')); ?>">
                        <?php echo csrf_field(); ?>
                        

    
   <div class="col-12" id="saveerrors" style="display:none">
    <div  class="alert alert-danger">
<p style="color: black;"><?php echo e(__('web.fillinput')); ?></p>
</div>
</div>

   <div class="col-12" id="savesuccess" style="display:none">
    <div  class="alert alert-success">
<p style="color: black;"><?php echo e(__('web.success')); ?></p>
</div>
</div>
                        
                    <div class="modal-body form-wrapper">
                        <div class="image-container" id="imagePreview" style="background-image: url('<?php echo e(url('')); ?>/assets/web/images/avatar.png');"> 
                            <input type="file" class="custom-file-input" id="imageUpload" name="photo" capture="">
                            <button><i class="far fa-edit"></i></button>
                        </div>
                        <div class="row mt-5">
                            <div class="col-lg-6">
                                <div class="form-group">
                                    <input type="text" class="form-control" name="name" value="<?php echo e($user->name); ?>" autocomplete="off" autofocus required />
                                    <label class="floating-label"> <?php echo e(__('web.name')); ?> </label>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="form-group">
                                    <input type="text" class="form-control" name="email"value="<?php echo e($user->email); ?>" autocomplete="off" autofocus required />
                                    <label class="floating-label"> <?php echo e(__('web.email')); ?> </label>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="form-group">
                                    <input type="password"  name="password" class="form-control"  id="password"  autocomplete="off" autofocus />
                                    <label class="floating-label"><?php echo e(__('web.password')); ?></label>
                                    <span class="togglePassword"><i class="far fa-eye" id="togglePassword"></i></span>
                                </div>
                            </div>
                           
                            <div class="col-lg-6">
                                <div class="form-group row">
                                    <div class="col-8 pl-0">
                                        <input type="text" name="phone" value="<?php echo e($user->phone); ?>" class="form-control" autocomplete="off" autofocus required />
                                        <label class="floating-label"> <?php echo e(__('web.phone')); ?> </label>
                                    </div>
                                    <div class="col-4 pr-0">
                                        <select class="form-control text-left" autocomplete="off" autofocus required >
                                            
                                            <?php $__currentLoopData = $countries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option <?php if($row->id == $user->country_id): ?> selected <?php endif; ?> value="<?php echo e($row->id); ?>"><?php echo e($row->abbr); ?> (<?php echo e($row->key); ?>)</option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="form-group">
                                    <select class="form-control" name="gender" autocomplete="off" autofocus required >
                                        <option <?php if($user->gender == '1'): ?> selected <?php endif; ?>  value="1"><?php echo e(__('web.male')); ?></option>
                                        <option <?php if($user->gender == '0'): ?> selected <?php endif; ?>  value="0"><?php echo e(__('web.female')); ?></option>
                                    </select>
                                    <label class="floating-label"> <?php echo e(__('web.gender')); ?> </label>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="form-group">
                                    <input class="form-control datepicker" type="date" name="date_of_birth" value="<?php echo e($user->date_of_birth); ?>"  data-date-format="mm/dd/yyyy" autocomplete="off" autofocus required />
                                    <label class="floating-label"> <?php echo e(__('web.date_of_birth')); ?> </label>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="form-group row">
                                    <div class="col-8 pl-0">
                                        <input type="text" class="form-control" name="tall" value="<?php echo e($user->tall); ?>"  autocomplete="off" autofocus required />
                                        <label class="floating-label"> <?php echo e(__('web.tall')); ?> </label>
                                    </div>
                                    <div class="col-4 pr-0">
                                        <select class="form-control text-left" autocomplete="off" autofocus required >
                                             <?php $__currentLoopData = $talls; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option <?php if($row->id == $user->tall_id): ?> selected <?php endif; ?> value="<?php echo e($row->id); ?>"><?php echo e(tallname($row->id)); ?></option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="form-group row">
                                    <div class="col-8 pl-0">
                                        <input type="text" class="form-control" name="weight" value="<?php echo e($user->weight); ?>"  autocomplete="off" autofocus required />
                                        <label class="floating-label"> <?php echo e(__('web.weight')); ?> </label>
                                    </div>
                                    <div class="col-4 pr-0">
                                        <select class="form-control text-left" autocomplete="off" autofocus required >
                                            <?php $__currentLoopData = $weights; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option <?php if($row->id == $user->weight_id): ?> selected <?php endif; ?> value="<?php echo e($row->id); ?>"><?php echo e(weightname($row->id)); ?></option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-6">
                            </div>
                        </div>                
                    </div>
                    <div class="modal-footer"> 
                        <button type="submit" class="main-butnn"><span><i class="fas fa-save"></i> <?php echo e(__('web.save')); ?></span></button>
                    </div>
                    </form>
                </div>

            </div>

        </div>
    </main>
<?php $__env->startPush('js'); ?>
<script>
     function savechange(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)
          {
            
            $("#saveerrors").css('display','none');
            $("#savesuccess").css('display','block');
            setTimeout(
  function()
  {
      location.reload();
  }, 1000);
               }
          ,error: function (data) {
              
              $("#savesuccess").css('display','none');
              $("#saveerrors").css('display','block');
              
   $('.is-invalid').removeClass('is-invalid');
              //$('#saveerrors').append('<h4 >'+value+'</h4>');
//              var result = [];

//   $.each(data.responseJSON.errors, function(key,value) {
//       result.push(value);
     
     
//  }); 

     
     $.each(data.responseJSON.errors, function(key,value) {
       $('.'+key).addClass('is-invalid');
     
     
 }); 
 
 
  //$("#savefailed").modal('show');
  
}
        })

           
        }
</script>

<script>
    function readURL(input) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();
            reader.onload = function(e) {
                $('#imagePreview').css('background-image', 'url('+e.target.result +')');
                $('#imagePreview').hide();
                $('#imagePreview').fadeIn(650);
            }
            reader.readAsDataURL(input.files[0]);
        }
    }
    $("#imageUpload").change(function() {
        readURL(this);
    });
</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/nawalgym/resources/views/web/pages/profile.blade.php ENDPATH**/ ?>