MOON
Server: Apache
System: Linux smtp.modiva.org 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64
User: rtbrisc (1005)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/rtbrisc/public_html/admin/main/helpdesk/details.php
<?php include("../general/header.php");  ?>
<?php
$ticketID = $_GET['tid'];
?>
  <body class="">
    <?php include("../general/navbar.php"); ?>
    <!-- BEGIN CONTENT -->
    <div class="page-container row-fluid">
      <?php include("../general/sidebar.php"); ?>
      <!-- BEGIN PAGE CONTAINER-->
      <div class="page-content">
        <div class="content">
          <!-- BEGIN PAGE TITLE -->
          <?php include("../general/customer_name.php"); ?>
          <!-- END PAGE TITLE -->
          <ul class="breadcrumb">
            <li>
              <p>REQUEST DETAILS</p>
            </li>
            <li><a href="../helpdesk/history.php" class="active">SERVICE HISTORY</a> </li>
            <li><a href="../helpdesk" class="active">HELPDESK</a> </li>
            <li><a href="../dashboard" class="active">DASHBOARD</a> </li>
          </ul>
          <?php
              require_once("../worker/workers/server/customer.php");
              require_once("../worker/workers/server/utilities.php");
              require_once("../worker/workers/server/issues.php");

              $history = mysqli_query($iss, "SELECT * FROM tblhelpdeskrequest WHERE TicketID = '$ticketID'");

              if($his_row = mysqli_fetch_assoc($history)){
                $ticket = $his_row['TicketID'];
                $techid = $his_row['TechnicianID'];
                $supporttrip = mysqli_query($iss, "SELECT * FROM tblsupporttrip WHERE TicketID = '$ticket' && TechnicianID = '$techid'");
                $trip_his = mysqli_fetch_assoc($supporttrip);
          ?>
          <!-- BEGIN PLACE PAGE CONTENT HERE -->
          <div class="row">
            <div class="col-md-12 col-vlg-12 col-sm-12">
              <div class="grid simple form-grid horizontal red">
                <div class="grid-title no-border">
                  <h3>TICKET ID: <a href="#" data-toggle="modal" data-target="#info"><?php echo $his_row['TicketID']; ?></a></h3>
                </div>
                <span class="text-danger"><?php echo @$_SESSION['det_err'] ?></span>
                <div class="grid-body no-border">
                  <h3>REQUEST UPDATE</h3>
                  <h4><b>Customer Contacted?:</b> 
                  <?php
                    $contact_query = mysqli_query($iss, "SELECT * FROM tblhelpdeskupdate WHERE TicketID = '$ticket'");
                    $contact_row = mysqli_fetch_assoc($contact_query);
                    if($contact_row){
                      echo $contact_row['CustomerContacted'];
                    }else{
                      echo "No";
                    }
                  ?></h4>
                  
                  <h4><b>Is replacement part required to fix the device?:</b> 
                  <?php
                    echo $contact_row['ReplacementRequired'];
                  ?></h4>

                  <h4><b>Cost of replacement part to be paid for:</b> 
                  <?php
                    if($contact_row['ReplacementRequired'] == "Yes"){
                      $detail = mysqli_query($iss, "SELECT * FROM tblpaymentinfo WHERE TicketID = '$ticket'");
                      echo '<table class="table table-striped table-advance table-hover" width="50%"" id="myTable">';
                      echo "<tr>";
                      echo "<th>Required Item</th>";
                      echo "<th>Price</th>";
                      echo "</tr>";
                      while($detail_row = mysqli_fetch_assoc($detail)){
                        echo "<tr>";
                        echo "<td>";
                        echo $detail_row['Item'];
                        echo "</td>";
                        echo "<td>";
                        echo $detail_row['ItemPrice'];
                        echo "</td>";
                        echo "</tr>";
                      }

                      $tot = mysqli_query($iss, "SELECT * FROM tblpaymentticket WHERE TicketID = '$ticket'");
                      $tot_row = mysqli_fetch_assoc($tot);
                      if($tot){
                        $num = $tot_row['ServiceCharge'] + $tot_row['TotalAmount'];
                        echo "<tr>";
                        echo "<td>Service Charge</td><td>" . $tot_row['ServiceCharge'] . "</td>";
                        echo "</tr>";
                        echo "<tr>";
                        echo "<td>Total</td><td>" . $num . "</td>";
                        echo "</tr>";
                      }
                      echo "</table>";
                    }else{
                      echo "Not Applicable";
                    }
                  ?></h4>

                  <h4>Technician Information: </h3>
                    <?php
                     if(empty($his_row['TechnicianID'])){
                    ?>
                          <b>Technician Assigned?: </b> No 
                      <span class="text-danger">(Technician Not yet Assigned)</span>
                    <?php
                     }else{
                        if ($trip_his) {
                    ?>
                          <b>Technician Assigned?: </b> Yes<br>
                          <b>Technician ID: </b> <?php echo $his_row['TechnicianID']; ?><br>
                          <b>Trip Status: </b> 
                          <?php 
                          if($trip_his['TripStatus'] == 0){
                            echo "Not Started";
                          }else if($trip_his['TripStatus'] == 1){
                            echo "Started";
                          }else if($trip_his['TripStatus'] == 2){
                            echo "Finished";
                          }else{
                            echo "Invalid Trip Status";
                          }
                          ?><br>
                          <b>Task Status: </b> 
                          <?php 
                          if($trip_his['TaskStatus'] == 0){
                            echo "Not Started";
                          }else if($trip_his['TaskStatus'] == 1){
                            echo "Started";
                          }else if($trip_his['TaskStatus'] == 2){
                            echo "Finished";
                          }else{
                            echo "Invalid Task Status";
                          }
                          ?><br>
                    <?php
                        }else{ echo "Invalid Ticket ID"; }
                     }
                    ?>

                  <h3>Payment Information</h3>
                  <b>Payment Status: </b> 
                  <?php
                   $tick = $his_row['TicketID'];
                     $pay = mysqli_query($iss, "SELECT * FROM tblpaymentticket WHERE TicketID = '$tick'"); 
                     $pay_row = mysqli_fetch_assoc($pay);
                     if($pay_row['PaymentStatus'] == 1){
                        echo "<span class='text-danger'>Payment Ticket Generated. Please go to your payment portal to proceed with payment</span>";
                     }else if($pay_row['PaymentStatus'] == 2){
                        echo "<span css='text-success'>Paid.</span>";
                     }else{
                        echo "Payment ticket not yet assigned.";
                     }
                  ?><br>

                  <?php

                    }else{
                      echo "No Details";
                    }
                  ?>
                  <br>
                   <?php
                  if($trip_his['TaskStatus'] == 2){
                  ?>
                    <a href="../rating/rate.php?cid=<?php echo $customerID; ?>&tid=<?php echo $techid; ?>" class="btn btn-primary" style="background-color: #C7100E; margin-bottom: 5px;">Acknowledge Support</a>
                    <a href="history.php" class="btn btn-primary" style="margin-bottom: 5px;">Back To Helpdesk List</a>
                  <?php  
                  }else{
                  ?>
                    <a href="history.php" class="btn btn-primary" style="margin-bottom: 5px;">Back To Helpdesk List</a>
                    <a href="#" data-toggle="modal" data-target="#<?php echo $ticket; ?>" class="btn btn-primary" style="background-color: #C7100E; margin-bottom: 5px;">Activate Request</a>
                  <?php
                  }
                  ?> 

                  <!-- Modal -->
                  <div class="modal fade" id="<?php echo $ticket; ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                    <div class="modal-dialog" role="document">
                      <div class="modal-content">
                          <div class="modal-header">
                            <h4 class="modal-title" id="myModalLabel"><b>Re-Activation Request (Ticket ID: <?php echo $ticket; ?>)</b></h4>
                          </div>
                          <div class="modal-body text-black">
                            Do you want to re-activate this request? Please contact our customer service for re-activation of this request
                          </div>
                          <div class="modal-footer">
                          <!-- <a href="activate.php?tid=<?php echo $ticketID; ?>" class="btn btn-primary" style="background-color: #C7100E;">Proceed</a> -->
                            <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                          </div>
                      </div>
                    </div>
                  </div>

                  <!-- Modal -->
                                  <div class="modal fade" id="info" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                                    <div class="modal-dialog" role="document">
                                      <div class="modal-content">
                                        <div class="modal-header">
                                          <h4 class="modal-title" id="myModalLabel">Ticket ID: <?php echo $his_row['TicketID']; ?></h4>
                                        </div>
                                        <div class="modal-body text-black">
                                              <!-- <b>Customer ID:</b> <?php echo $his_row['CustomerID']; ?><br> -->
                                              <h3>Request Information</h3>
                                              <b>Support Plan:</b> 
                                              <?php 
                                              $supportID = $his_row['SupportPlanID'];
                                              $support = mysqli_query($utl, "SELECT * FROM tblsupportplan WHERE SupportPlanID = $supportID");
                                              $support_row = mysqli_fetch_assoc($support);
                                              echo $support_row['SupportPlanText']; 
                                              ?><br>
                                              <b>Request:</b> 
                                              <?php
                                               $requestID = $his_row['RequestID'];
                                               $request = mysqli_query($utl, "SELECT * FROM tblrequest WHERE RequestID = $requestID "); 
                                               $request_row = mysqli_fetch_assoc($request);
                                               echo $request_row['RequestText'];
                                              ?><br>
                                              <b>Request Type:</b> 
                                              <?php
                                               $requestTypeID = $his_row['RequestTypeID'];
                                               $request_type = mysqli_query($utl, "SELECT * FROM tblrequesttype WHERE RequestID = $requestID && RequestTypeID = $requestTypeID"); 
                                               $request_type_row = mysqli_fetch_assoc($request_type);
                                               echo $request_type_row['RequestTypeText'];
                                              ?><br>
                                              <b>Device Type:</b> 
                                              <?php
                                               $deviceType = $his_row['DeviceTypeID'];
                                               $device = mysqli_query($utl, "SELECT * FROM tbldevice WHERE DeviceID = $deviceType "); 
                                               $devicetype_row = mysqli_fetch_assoc($device);
                                               echo $devicetype_row['DeviceText'] . " -" . $his_row['DeviceTypeInfo'];
                                              ?><br>
                                              <b>Device Brand:</b> 
                                              <?php
                                               $deviceBrand = $his_row['DeviceBrandID'];
                                              $device_brand = mysqli_query($utl, "SELECT * FROM tbldevicebrand WHERE DeviceBrandID = $deviceBrand ");
                                               $device_brand_row = mysqli_fetch_assoc($device_brand);
                                               echo $device_brand_row['DeviceBrandText'] . " -" . $his_row['DeviceBrandInfo'];
                                              ?><br>
                                              <b>Device Model:</b> <?php echo $his_row['DeviceModel']; ?><br>
                                              <b>Description:</b> <?php echo $his_row['Description']; ?><br>
                                              <b>Support Time Type:</b> 
                                              <?php 
                                              $supporttimetype = $his_row['SupportTimeType']; 
                                              $time_his = mysqli_query($utl, "SELECT * FROM tblsupporttime WHERE SupportTimeID = '$supporttimetype'");
                                              $time_his_row = mysqli_fetch_assoc($time_his);
                                              echo $time_his_row['SupportTimeType'];
                                              ?><br>
                                              <b>Support Time:</b> <?php echo $his_row['SupportTime']; ?><br>

                                              <h3>Contact Information</h3>
                                              <?php
                                              $tick = $his_row['TicketID'];
                                              $contact = mysqli_query($iss, "SELECT * FROM tblsupportinfo WHERE TicketID = '$tick'");
                                              $contact_row = mysqli_fetch_assoc($contact);
                                              echo "Contact Name: " . $contact_row['SupportName'] . "<br>";
                                              echo "Contact Number: " . $contact_row['SupportNumber'] . "<br>";
                                              echo "Contact Email: " . $contact_row['SupportEmail'] . "<br>";
                                              echo "Contact Location: " . $contact_row['SupportLocation'] . "<br>";
                                              ?>
                                        </div>
                                        <div class="modal-footer">
                                          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                          <button type="button" class="btn btn-primary" onclick="PrintThis('<?php echo $his_row['TicketID']; ?>')">Print Ticket</button>
                                        </div>
                                      </div>
                                    </div>
                                  </div>

                  <br>
                </div>
              </div>
            </div>
          </div>
          <!-- END DASHBOARD TILES -->
          <!-- END PLACE PAGE CONTENT HERE -->
        </div>
      </div>
      <!-- END PAGE CONTAINER -->
      <?php include("../general/chat_bar.php"); ?>
    </div>
    <!-- END CONTENT -->
    <?php include("../general/footer.php"); ?>
  </body>
</html>