JezK
Edit File: mycareclubs.php
<?php include('userObject.php'); $userCareClubPurchagesData = $user->getUserCareClubPurchagesData($_POST); $purachaseCount = count($userCareClubPurchagesData); $htmlText = ''; if ($purachaseCount > 0) { foreach ($userCareClubPurchagesData as $singleCareClubData) { $allotmentDetails = $user->getAllotmentDetails($singleCareClubData['id']); $purchaseDetails = unserialize($allotmentDetails['care_club_details']); $careClubName = $purchaseDetails['careClubName']; $serviceNames = json_decode($purchaseDetails['serviceNames']); $vehicleType = $purchaseDetails['vehicletype']; $vehicleNumber = $purchaseDetails['vehicleNumber']; $model = $purchaseDetails['model']; $totalServices = $purchaseDetails['totalServices']; $vechicleDetails = unserialize($allotmentDetails['care_club_vechile_details']); $createdAtString = $allotmentDetails['created_date']; $createdAt = new DateTime($createdAtString); $formattedcreatedAt = $createdAt->format('d-m-Y'); $planYears = $purchaseDetails['planType']; $expiryDate = date('d-m-Y', strtotime('+'.$planYears.'years', strtotime($createdAtString))); $htmlText .= '<div class="mypackage-box"> <div class="row mt-5"> <div class="col-lg-4 col-md-12 pb-3"> <img src="./images/package2.jpg" class="img-fluid"> </div> <div class="col-sm-7 col-md-6"> <div class="row mt-4">'; $i = 0; $completedServices = 0; foreach ($serviceNames as $index => $singleService) { if (isset($vechicleDetails[$index])) { if ($vechicleDetails[$index]['status'] == 1) { $completedServices += 1; } $htmlText .= '<div class="col-6"> <label class="de-check">' . $singleService . ' <input type="checkbox" disabled checked="checked"> <span class="checkmark"></span> </label> </div>'; } } $htmlText .= ' </div> </div> <div class="col-sm-2 col-md-2"> <p class="mp-text"> Service:' . $completedServices . '/' . $totalServices . '</p> </div> </div> <div class="row"> <div class="col-4"> <div class="row"> <div class="col-md-5"> <p class="fw-bold">' . $careClubName . '</p> </div> <div class="col-md-7"> <p class="">Expired on: <span class="de-primary-color fw-bold">' . $expiryDate . '</span> </p> <p class="">Issued on: <span class="de-primary-color fw-bold">'.$formattedcreatedAt.'</span></p> </div> </div> </div> <div class="col-8"> <div class="d-flex justify-content-end"> <div class="d-flex align-items-center"> <a href="' . getenv('BASE_URL') . 'App/userInvoicepdf.php?allotmentId=' . $singleCareClubData['id'] . '" class="" style="width: 10%;" data-toggle="tooltip" title="Download Invoice" data-bs-original-title="Download Invoice" data-bs-html="true" data-bs-boundary="viewport" data-bs-container="body" data-bs-placement="top" data-bs-custom-class="tooltip-sm"> <i class="fa fa-download" aria-hidden="true" style="font-size: 1.4em; top: 20px; right: 10px;"></i> </a> <button class="de-btns de-blue-btn ml-3"><a href="careClubHistory.php?allotmentId='.$singleCareClubData['id'].'">View History</a></button> </div> </div> </div> </div>'; } $response = json_encode(array("mypackageData" => $htmlText, "count" => $purachaseCount)); } else { $response = json_encode(array("mypackageData" => "You Haven't Purchased any thing!", "count" => 0)); } $getDataCount = 1; echo $response;