<style>
.percircle.big {
    font-size: 141px !important;
}
.percircle {
    position: relative;
    width: 140px !important;
    height: 140px !important;
}    
  
</style>


<?php $__env->startSection('content'); ?>
      <div class="common-content">
          <div class="page-content">
                <div class="page-heading">
                    <div class="headings">
                        <h6>My Dashboard</h6>
                    </div>
                </div>
              
                <div class="dashboard-cnts">
                    <div class="row">
                        <div class="col-12 blink">
                            <div class="bid-stats buyers">
                                     <?php 
                            
                            
                            if(!empty($userdata->name)){
                                $val2 = '1';
                            }else{
                                $val2 = '0';
                            }
                            
                            if(!empty($userdata->email)){
                                $val3 = '1';
                            }else{
                                $val3 = '0';
                            }
                            
                            if(!empty($userdata->phone_no)){
                                $val4 = '1';
                            }else{
                                $val4 = '0';
                            }
                            
                            
                            if(!empty($userdata->address)){
                                $val5 = '1';
                            }else{
                                $val5 = '0';
                            }
                            
                            
                            if(!empty($userdata->state)){
                                $val6 = '1';
                            }else{
                                $val6 = '0';
                            }
                            
                            if(!empty($userdata->city)){
                                $val7 = '1';
                            }else{
                                $val7 = '0';
                            }
                            
                            if(!empty($userdata->zipcode)){
                                $val8 = '1';
                            }else{
                                $val8 = '0';
                            }
                            
                            if(!empty($userdata->contact_name)){
                                $val9 = '1';
                            }else{
                                $val9 = '0';
                            }
                            
                            if(!empty($userdata->contact_phone_no)){
                                $val10 = '1';
                            }else{
                                $val10 = '0';
                            }
                            
                            if((Auth::user()->user_type == '1')||(Auth::user()->user_type == '5')||(Auth::user()->user_type == '6')||(Auth::user()->user_type == '4')){
                                if(!empty($userdata->buyer_type)){
                                $val11 = '1';
                                }else{
                                    $val11 = '0';
                                }
                             }elseif(Auth::user()->user_type == '2'){
                                if(!empty($userdata->vendor_type)){
                                $val11 = '1';
                                }else{
                                    $val11 = '0';
                                }
                             }
                             
                             if(!empty($userdata->description)){
                                $val12 = '1';
                                }else{
                                    $val12 = '0';
                                }
                             
                             $total = round(($val2+$val3+$val4+$val5+$val6+$val7+$val8+$val9+$val10+$val11+$val12)*100/11);
                             
                            //print_r($total);
                            
                            ?>

                        <?php if(Auth::user()->user_status==0): ?>

                        <div style="background-color:red;text-align:center;margin:auto;font-size: 14px;     padding: 8px;color: #fff;    font-weight: 200;    border-radius: 5px 5px 5px 5px; "><b>You can perform the further process only after the Administrator has activated your account</b></div>

                        <?php endif; ?>

                       


                    <?php if(Auth::user()->user_status==1): ?>
                            <?php if($total < 100): ?>
                            <div style="background-color:red;text-align:center;margin:auto;font-size: 14px;     padding: 8px;color: #fff;    font-weight: 200;    border-radius: 5px 5px 5px 5px; "><b>Your Profile is incomplete, Please <a href="<?php echo e(url('userprofile')); ?>">click here</a> to complete your profile before creating a purchase order </b></div>
                            <?php endif; ?>
                            
                            <?php if($sold_count != $registered_count): ?>
                                <div style="    margin-top: 10px; background-color:#fdca49;text-align:center;font-size: 14px;     padding: 8px;color: #000;    font-weight: 200;    border-radius: 5px 5px 5px 5px; "><b>The vendor has completed the registration of sold products. Please verify the details and approve the product to avail other services.<a href="<?php echo e(url('buyers/asset_management')); ?>">Click here</a></b></div>
                            <?php endif; ?>
                                

                            <?php
                                $hosdetails  			= App\Helpers\CustomHelper::hospitadetails(Auth::user()->id);
                            ?>






                             

                                
                                <div class="row">
                                    <div class="col-md-4">
                                        <a href="<?php echo e(url('buyers/asset_management')); ?>">
                                        <div class="grid-box  comp-st4">
                                            <div class="box-icon">
                                                <img src="<?php echo e(url('assets/images/buy-d7.png')); ?>">
                                            </div>
                                            <div class="boxvalue-head">
                                                AMC and CMC request 
                                            </div>
                                            <div class="box-value "><?php echo e($hosdetails['amc_cmcrequest']); ?></div>
                                        </div>
                                    </a>
                                    </div>
                                    <div class="col-md-4">
                                     <a href="<?php echo e(url('buyers/asset_management')); ?>">
                                        <div class="grid-box  comp-st5">
                                            <div class="box-icon">
                                                <img src="<?php echo e(url('assets/images/buy-d8.png')); ?>">
                                            </div>
                                            <div class="boxvalue-head">
                                                Validation Request 
                                            </div>
                                            <div class="box-value"><?php echo e($hosdetails['validationreqcount']); ?></div>
                                        </div>
                                       </a>
                                    </div>
                                    <div class="col-md-4">
                                        <a href="<?php echo e(url('buyers/asset_management')); ?>">
                                        <div class="grid-box comp-st6">
                                            <div class="box-icon">
                                                <img src="<?php echo e(url('assets/images/buy-d9.png')); ?>">
                                            </div>
                                            <div class="boxvalue-head">
                                                Warranty Expiry
                                            </div>
                                            <div class="box-value"><?php echo e($hosdetails['warrantyexpired']); ?></div>
                                        </div>
                                       </a>
                                    </div>
                                </div>


                                <h3 class="box-head">Bid Statistics</h3>
                                <div class="row">
                                    <div class="col-md-4">
                                        <a href="<?php echo e(url('buyers/quotestatus')); ?>">
                                        <div class="grid-box blue">
                                            <div class="box-icon">
                                                <img src="<?php echo e(url('assets/images/buy-d1.png')); ?>">
                                            </div>
                                            <div class="boxvalue-head">
                                                Total Active Quotes
                                            </div>
                                            <div class="box-value"><?php echo e(count($quotes1)); ?></div>
                                        </div>
                                    </a>
                                    </div>
                                    <div class="col-md-4">
                                    
                                        <a href="<?php echo e(url('buyers/quotestatus')); ?>">   
                                        
                                        <div class="grid-box green">
                                            <div class="box-icon">
                                                <img src="<?php echo e(url('assets/images/buy-d2.png')); ?>">
                                            </div>
                                            <div class="boxvalue-head">
                                                Bids Received Against Active Bids
                                            </div>
                                            <div class="box-value"><?php echo e(count($bids)); ?></div>
                                        </div>
                                    </a>
                                    </div>
                                    <div class="col-md-4">
                                        <a href="<?php echo e(url('buyers/quotestatus')); ?>">
                                        <div class="grid-box red">
                                            <div class="box-icon">
                                                <img src="<?php echo e(url('assets/images/buy-d3.png')); ?>">
                                            </div>
                                            <div class="boxvalue-head">
                                                Total Bids Completed
                                            </div>
                                            <div class="box-value"><?php echo e(count($bidscompleted)); ?></div>
                                        </div>
                                    </a>
                                    </div>
                                </div>


                            </div>
							
							<?php if(count($equipmentstatus) != 0): ?>
							
                            <div class="row"> 
                                <div class="col-md-12">
                                    <h3 class="sub-headings">Equipment status</h3>
                                    <div class="tableBox wraper">
                                    <table class="display table">
                                        <thead>
                                           <tr>
                                              <th>Model Number</th>
											  <th>Serial Number</th>
											  <th>Department Name</th>
                                              <th>Product Name</th>
                                              <th>Vendor</th>
                                              <th>Status </th>
                                           </tr>
                                        </thead>
                                        <tbody>

                                            
                                           
                                            <?php if(count($equipmentstatus) > 0): ?>
                                             <?php $__currentLoopData = $equipmentstatus; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $equpstatus): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                             <tr  class='clickable-row' data-href='<?php echo e(url('buyers/registerproduct_details/'.$equpstatus->registeredid)); ?>'>
                                            
												 <?php if($equpstatus->type=='approve'): ?>
													   <?php
														$pname  			= App\Helpers\CustomHelper::product_name($equpstatus->product_id);
													   ?>
													   <?php
														$pdetails  			= App\Helpers\CustomHelper::vendorproduct_details($equpstatus->product_id);

                                                        
														$modelno 			= $pdetails->product_code;
													   ?>
												 <?php else: ?>
													 <?php
													   $pname  			= App\Helpers\CustomHelper::product_existing_name($equpstatus->existing_product_id);
													 ?>
													  <?php
													  $modelno 			= $equpstatus->product_code_existing;
													 ?>
												 <?php endif; ?>
										 
                                                <td><?php echo e($modelno); ?></td>
												<td><?php echo e($equpstatus->product_serial_no); ?></td>
												<td><?php echo e(ucfirst($equpstatus->departmentname)); ?></td>
                                                <td><?php echo e($pname); ?></td>
                                                <td>
												 <?php if($equpstatus->type=='approve'): ?>
													 <?php echo e(ucfirst($equpstatus->vendorname)); ?>

												 <?php else: ?>
													  <?php if($equpstatus->vendor_data=='out'): ?>
														  <?php echo e(ucfirst($equpstatus->existing_out_vendor)); ?>

													  <?php else: ?>
														  <?php echo e(ucfirst($equpstatus->vendorname)); ?>

													  <?php endif; ?>
													 
												 <?php endif; ?>
												
												</td>
											
												<?php 
													$product_warranty = $equpstatus->warrenty;
													$current_date 	  = date('d-m-Y');
													$validation_date =$equpstatus->validation_date;
													$activated_enddate=$equpstatus->activated_enddate;
													$activate_val=$equpstatus->activate_val;
												    $activate_status=$equpstatus->activate_status;
													$status_amc='';
												?>	
												<?php
													$dayswarrenty  			= App\Helpers\CustomHelper::dateDiffInDays($current_date,$product_warranty);
											    ?>
												<?php
													$daysvalidity  			= App\Helpers\CustomHelper::dateDiffInDays($current_date,$validation_date);
											    ?>
												<?php
													$amcexpired  			= App\Helpers\CustomHelper::dateDiffInDays($current_date,$activated_enddate);
											    ?>
											
													<?php
														
														if(strtotime($product_warranty) >= strtotime($current_date)){
															
															if(($dayswarrenty== '+1')||($dayswarrenty== '+2')||($dayswarrenty== '+3')||($dayswarrenty== '+4')||($dayswarrenty== '+5')||($dayswarrenty== '+6')||($dayswarrenty== '+7')){
																$status_warrenty='<span class="status red">Warranty About to Expire</span>';
															}
															else{
																$status_warrenty = '<span class="status green">In Warranty</span>';
															}
														
														}else{
																$status_warrenty = '<span class="status red">Out of Warranty</span>';
														}
													
                                                    if(strtotime($validation_date) >= strtotime($current_date)){
														
														
														
														if(($daysvalidity== '+1')||($daysvalidity== '+2')||($daysvalidity== '+3')||($daysvalidity== '+4')||($daysvalidity== '+5')||($daysvalidity== '+6')||($daysvalidity== '+7')){
															$status_validity='<span class="status red">Validation date about to expire</span>';
														}
														else{
															$status_validity = '<span class="status green">In Validity</span>';
														}
													
                                                    }else{
                                                            $status_validity = '<span class="status red">Out of Validity</span>';
															
															$validation_date;
                                                    }
													
													if(($activate_status==0)){
														
														if(strtotime($product_warranty) >= strtotime($current_date)){
															
															$status_amc='';
														}
														else{
															
															$status_amc='<span class="status orange">'.strtoupper($activate_val).' '.'Contract not activated</span>';
														}
														
													}
													elseif($activate_status==1){
														 $status_amc='<span class="status orange">'.strtoupper($activate_val).' '.'Pending'.'</span>';
													}
													elseif(($activate_status==3)||($activate_status==4)){
														 $status_amc='<span class="status orange">'.strtoupper($activate_val).' '.'Pending'.'</span>';
													}
													
													elseif(strtotime($activated_enddate) >= strtotime($current_date)){
														
														if(($amcexpired== '+1')||($amcexpired== '+2')||($amcexpired== '+3')||($amcexpired== '+4')||($amcexpired== '+5')||($amcexpired== '+6')||($amcexpired== '+7')){
															$status_amc='<span class="status red">'.strtoupper($activate_val).' '.'About to Expire</span>'; 
														}
														else{
															$status_amc = '<span class="status green">'.'In'.' '.strtoupper($activate_val);
														}
													
                                                    }else{
                                                            $status_amc ='<span class="status red">'.strtoupper($activate_val).' '.'Expired';
                                                    }
											
                                               ?>
                                                <td class="align"> <?php echo $status_warrenty;?>
													 <?php echo $status_validity?>
												     <?php echo $status_amc?>
												
												</td>
                                            </tr>
                                              <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php else: ?>
                                            <tr><td>No Orders available</td></tr>
                                            <?php endif; ?>
                                        </tbody>
                                    </table>
                                    </div>
                                </div> 
                            </div>
						<?php endif; ?>
                            <!-- Equipment status TABLE-END -->
							
							
							
							
                      <?php if(count($orderdetails)!= 0): ?>
                            <div class="row"> 
                                <div class="col-md-12">
                                    <h3 class="sub-headings">Order Details</h3>
                                    <div class="tableBox wraper">
                                    <table class="display table">
                                        <thead>
                                           <tr>
                                              <th>ID</th>
                                              <th>Product Name</th>
                                              <th>Vendor</th>
                                              <th>Total Price</th>
                                              <th>Status </th>                         
                                              <th>Date  </th>
                                           </tr>
                                        </thead>
                                        <tbody>
                                            <?php if(count($orderdetails) > 0): ?>
                                             <?php $__currentLoopData = $orderdetails; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $orders): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <tr>
                                                <td><?php echo e($orders->product_code); ?></td>
                                                <td><?php echo e($orders->product_name); ?> </td>
                                                <td><?php echo e($orders->name); ?> </td>
                                                <?php
                                                    $amount = ($orders->bid_price * $orders->bid_tax / 100);
                                                    $totalamount = $orders->bid_price + $amount ;
                                                ?>
                                                <td><?php echo e($totalamount); ?> INR </td>
                                                <td><?php if($orders->bid_status == '4'): ?>
                                                <span class="status grey">Order Placed</span>
                                                <?php elseif($orders->bid_status == '5'): ?>
                                                <span class="status green">Dispatched</span>
                                                <?php elseif($orders->bid_status == '13'): ?>
                                                <span class="status blue">In Production</span>
                                                <?php elseif($orders->bid_status == '14'): ?>
                                                <span class="status blue">In Packaging</span>
                                                <?php endif; ?></td>
                                                <td><?php if($orders->bid_status == '4'): ?>
                                                <?php echo e(date('d-m-Y', strtotime($orders->ordered_date))); ?>

                                                <?php elseif($orders->bid_status == '5'): ?>
                                                
                                                 <?php echo e(date('d-m-Y', strtotime($orders->product_dispatched_date))); ?>

                                                <?php elseif($orders->bid_status == '13'): ?>
                                                
                                                 <?php echo e(date('d-m-Y', strtotime($orders->inproduction_date))); ?>

                                                <?php elseif($orders->bid_status == '14'): ?>
                                                
                                                 <?php echo e(date('d-m-Y', strtotime($orders->inpackage_date))); ?>

                                                <?php endif; ?></td>
                                            </tr>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php else: ?>
                                            <tr><td>No Orders available</td></tr>
                                            <?php endif; ?>
                                        </tbody>
                                    </table>
                                    </div>
                                </div> 
                            </div>
                            <!-- Order Details TABLE-END -->
                        <?php endif; ?>  
                        
                        
                            <!-- Complaint Details TABLE-END -->
                            
                           <!--  <h3 class="sub-headings">Our Partners</h3>
                            <div class="partner-ships"> <div class="row">
                                <div class="col-md-4">
                                    <div class="partner-box">
                                        <div class="partner-logo">
                                            <img src="<?php echo e(url('assets/images/hospital.jpg')); ?>">
                                        </div>
                                        <div class="partner-details">
                                            <h6>Newlife Hospital</h6>
                                            <p><i class="fas fa-map-marker-alt"></i> 2nd Street, New York</p>
                                            <div class="rating">
                                                <span class="fa fa-star checked"></span>
                                                <span class="fa fa-star checked"></span>
                                                <span class="fa fa-star checked"></span>
                                                <span class="fa fa-star"></span>
                                                <span class="fa fa-star"></span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-4">
                                    <div class="partner-box">
                                        <div class="partner-logo">
                                            <img src="<?php echo e(url('assets/images/hospital.jpg')); ?>">
                                        </div>
                                        <div class="partner-details">
                                            <h6>Newlife Hospital</h6>
                                            <p><i class="fas fa-map-marker-alt"></i> 2nd Street, New York</p>
                                            <div class="rating">
                                                <span class="fa fa-star checked"></span>
                                                <span class="fa fa-star checked"></span>
                                                <span class="fa fa-star checked"></span>
                                                <span class="fa fa-star"></span>
                                                <span class="fa fa-star"></span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div> </div>
                        </div>
                    </div>
                </div>
          </div>-->

          <?php endif; ?>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('scripts'); ?>
<script>
<?php if(Session::has('message')): ?>
      swal({
        title: "",
        text: "<?php echo e(Session::get('message')); ?>",
        type: "success",
        showCancelButton: false,
        dangerMode: false,
        confirmButtonText: 'OK',

    });
<?php endif; ?>

</script>
          
          



<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.main', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/meddbot/public_html/resources/views/buyers/dashboard.blade.php ENDPATH**/ ?>