JezK
Edit File: myservices.php
<?php ini_set('display_errors', 1); include('userObject.php'); $result = $user->getmyservices($_POST); $getDataCount = $result['count']; if ($getDataCount > 0) { $data = array(); $data1 = ''; $data2 = ''; foreach ($result['myservices'] as $row) { $dateString = $row['created_date']; $dateTime = new DateTime($dateString); $convertedDate = $dateTime->format('d-m-Y'); $serviceDate = isset($row['serviceDate']) ? $row['serviceDate'] : null; $serviceDateDisplay = $serviceDate ? (new DateTime($serviceDate))->format('d-m-Y') : ''; $data[] = '<div class="col-sm-6 col-md-4"> <div class="product-box"> <div class="row"> <div class="col-md-12 d-flex align-items-center justify-content-center"> <a href="' . getenv('BASE_URL') . 'App/userInvoicepdf.php?allotmentId=' . $row['allotmentId'] . '" class="d-flex align-items-center justify-content-center" style="width: 100%; height: 100%;" 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.5em; position: absolute; top: 10px; right: 10px;"></i> <img src="./uploads/services/' . $row['image'] . '" class="img-fluid de-images" /> </a> </div> <div class="col-md-12"> <p class="pd-title"> ' . $row['servicesName'] . '</p> </div> </div> <div class="package-name"> <p class="product-price"> <span class="text-dark">Purchased on: </span>' . $convertedDate . ' </p> <p class="product-price"> Rs.' . $row['cost'] . ' </p> <p style = "color:black; font-size: 18px; text-align: center; font-weight:500"; font-family: "Montserrat";>'; if ($row['status'] == 'Pending') { if ($serviceDate !='0') { $data[] .= '<span class="text-dark" style = "font-size: 16px;">Your service date:</span><br><span class="text-danger" style = "font-size: 16px; font-weight:bold;">' . $serviceDateDisplay . '</span>'; } else { $data[] .= '<p class="text-dark mr-3" style = "font-size: 16px; text-align: center;" >Set your service date </p>'; $data[] .= '<div class="d-flex justify-content-center">'; $data[] .= '<div class="input-group" style="max-width:200px;"> <input type="date" class="form-control" style="background-color: white; border: 1px solid black;" onchange="changeServiceDate(\'' . $row['servicesName'] . '\', this.value, \'' . $row['allotmentId'] . '\')" min="' . date('Y-m-d') . '" '; if ($serviceDate) { $data[] .= 'value="' . $serviceDate . '"'; } $data[] .= '>'; $data[] .= ' </div>'; $data[] .= '</div>'; } } elseif ($row['status'] == 'Complete' && $serviceDate) { $data[] .= '<span class="text-dark" style = "font-size: 16px; " >Your service used on:</span><br><span class="text-success" style = "font-size: 16px; font-weight:bold;">' . $serviceDateDisplay . '</span>'; } $data[] .= '</p> </div> </div> </div>'; } $data1 = json_encode(array("myservicesData" => implode('', $data), "count" => $result['count'])); } else { $data1 = json_encode(array("myservicesData" => "You Haven't Purchased anything!", "count" => $result['count'])); } echo $data1; ?>