progress.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <?php
  2. date_default_timezone_set("Australia/Hobart");
  3. //error_reporting(E_ERROR | E_PARSE);
  4. error_reporting(E_ALL);
  5. ini_set('display_errors', '0');
  6. ini_set('log_errors', '1');
  7. require_once 'connection.php';
  8. include_once "vendor/autoload.php";
  9. $accessToken = getenv('HUBSPOT_TOKEN') ?: '';
  10. $enquiry_date = date("l dS M \'y");
  11. $drg = isset($_GET['drg']) ? (int)$_GET['drg'] : 0;
  12. if (!empty($_GET['drg'])) {
  13. include "table.php";
  14. }
  15. ?>
  16. <!doctype html>
  17. <html lang="en">
  18. <head>
  19. <meta charset="utf-8">
  20. <meta name="viewport" content="width=device-width, initial-scale=1">
  21. <title><?php echo $drg ? "{$drg} - " : ''; ?>Payment Plan Tracker</title>
  22. <link rel="shortcut icon" href="images/blueprint.ico" type="image/x-icon">
  23. <link href="css/bootstrap.css" rel="stylesheet">
  24. <link href="css/blueprint.css" rel="stylesheet">
  25. <link href="css/print.css" rel="stylesheet" media="print">
  26. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.min.css">
  27. <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
  28. </head>
  29. <body>
  30. <nav class="navbar bg-brown-dark brown-light border-bottom border-body d-print-none" data-bs-theme="dark">
  31. <div class="container-fluid">
  32. <a class="navbar-brand brown-light" href="dashboard.php">
  33. <img src="images/blueprint-logo-light.png" alt="Logo" width="30" height="24" class="d-inline-block align-text-top">
  34. Modulos Design
  35. </a>
  36. <div class="ms-auto d-flex gap-2">
  37. <a href="dashboard.php" class="btn btn-sm btn-outline-light"><i class="bi bi-grid-fill"></i> Dashboard</a>
  38. <?php if (!empty($drg)): ?><a href="client-brief.php?drg=<?= (int)$drg ?>" class="btn btn-sm btn-outline-light"><i class="bi bi-person-fill"></i> Client Brief</a><?php endif; ?>
  39. </div>
  40. </div>
  41. </nav>
  42. <div class="container">
  43. <div class="row pt-2">
  44. <div class="col-sm-4 col-md-4 pt-3">
  45. <img class="img-fluid logo pt-2" src="images/blueprint-full-logo-medium.png" alt="Blueprint Studio">
  46. </div>
  47. <div class="col-sm-4 col-md-4 m-auto text-center">
  48. <h3 class="architect text-center">Job: <?php echo $drg; ?></h3>
  49. </div>
  50. <div class="col-sm-4 col-md-4 text-end pt-3">
  51. <h2 class="fw-bold text-end mb-1">Client Onboarding Form</h2>
  52. <h4 class="text-end mb-1">
  53. <span class="fw-bold brown-two"><?php echo $enquiry_date; ?></span>
  54. </h4>
  55. </div>
  56. </div>
  57. <div class="row">
  58. <div class="col-12">
  59. <div class="row ">
  60. <div class="col ">
  61. <h4 class="fw-bold">Client Details</h4>
  62. </div>
  63. </div>
  64. <div class="mb-1">
  65. <div class="row ">
  66. <div class="col-6 col-md-3">
  67. <label for="firstname" class="form-label form-label-sm p-0 m-0">Clients Name</label>
  68. <input type="text" class="form-control form-control-sm savable-text-field architect brown-four" name="firstname" id="firstname" tabindex="1" value="<?php echo $firstname; ?>" placeholder="First Name" autocomplete="given-name">
  69. </div>
  70. <div class="col-6 col-md-3">
  71. <label for="lastname" class="form-label form-label-sm p-0 m-0"></label>
  72. <input type="text" class="form-control form-control-sm savable-text-field architect brown-four" name="lastname" id="lastname" tabindex="2" value="<?php echo $lastname; ?>" placeholder="Last Name" autocomplete="family-name">
  73. </div>
  74. <div class="col-12 col-md-6">
  75. <label for="joint_name" class="form-label form-label-sm p-0 m-0">T/As - Joint Names</label>
  76. <input type="text" class="form-control form-control-sm savable-text-field architect brown-three" name="joint_name" id="joint_name" value="<?php echo $joint_name; ?>" tabindex="3">
  77. </div>
  78. </div>
  79. </div>
  80. <div class="mb-1">
  81. <label for="postal_address" class="form-label form-label-sm p-0 m-0">Clients Postal Address</label>
  82. <input type="text" class="form-control form-control-sm fw-bold savable-text-field architect brown-three map-autocomplete" id="postal_address" name="postal_address" value="<?php echo $postal_address; ?>" onFocus="geolocate(this)" tabindex="4" autocomplete="on">
  83. </div>
  84. <div class="mb-1">
  85. <div class="row ">
  86. <div class="col-md-6">
  87. <label for="phoneNumber" class="form-label form-label-sm p-0 m-0">Clients Mobile</label>
  88. <input type="phone" class="form-control form-control-sm savable-text-field architect brown-three" minlength="12" id="phoneNumber" name="client_mobile" value="<?php echo $client_mobile; ?>" required onkeyup="check(); return false;" tabindex="5" autocomplete="tel">
  89. </div>
  90. <div class="col-md-6">
  91. <label for="client_email" class="form-label form-label-sm p-0 m-0">Email address</label>
  92. <input type="email" class="form-control form-control-sm savable-text-field architect brown-three" name="client_email" id="client_email" value="<?php echo $client_email; ?>" tabindex="6" autocomplete="email">
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. <div class="row mt-3">
  98. <div class="col-md-2">Item</div>
  99. <div class="col-md-7">Description</div>
  100. <div class="col">Price</div>
  101. </div>
  102. <hr>
  103. <?php
  104. $checkRecord = mysqli_query($con, "SELECT * FROM `progress_payments` WHERE `drg` = '{$drg}' " );
  105. $rowcount = mysqli_num_rows($checkRecord);
  106. $result = mysqli_query($con, "SELECT *, @curRow := @curRow + 1 AS position FROM `progress_payments` JOIN (SELECT @curRow := 0) r WHERE `drg` = '{$drg}' ");
  107. if (!$result) {
  108. printf("Error: %s\n", mysqli_error($con));
  109. exit();
  110. }
  111. while ($row = mysqli_fetch_array($result)) {
  112. echo "<div class='mb-1 row justify-content-start'>";
  113. echo "<label for='description' class='col-1 col-form-label'>" . (int)$row['position'] . "</label>";
  114. echo "<input type='hidden' id='progress' v-model='progress' value='" . (int)$row['position'] . "'>";
  115. echo "<div class='col-sm-7'>";
  116. echo "<input type='text' class='form-control' id='description' v-model='description' value='" . htmlspecialchars($row['description'], ENT_QUOTES, 'UTF-8') . "' disabled>";
  117. echo "</div>";
  118. echo "<div class='col-sm-2'>";
  119. echo "<input type='text' class='form-control' id='paid' v-model='paid' value='" . htmlspecialchars($row['paid'], ENT_QUOTES, 'UTF-8') . "' disabled>";
  120. echo "</div>";
  121. echo "<div class='col-sm-2'>";
  122. echo "<input type='currency' class='form-control' id='value' v-model='value' value='" . htmlspecialchars($row['value'], ENT_QUOTES, 'UTF-8') . "' disabled>";
  123. echo "</div>";
  124. echo "</div>";
  125. }
  126. ?>
  127. <div id="progress_payments">
  128. </div>
  129. <div class="row justify-content-end">
  130. <div class="">
  131. <button id="btn" class="btn btn-sm btn-block bg-brown-three brown-five col-3">Add Item</button>
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. <script>
  137. var count= <?php echo $rowcount + 1; ?>;
  138. $("#btn").click(function(){
  139. $("#progress_payments").append(addNewRow(count));
  140. count++;
  141. });
  142. function addNewRow(count){
  143. var newrow='<div class="mb-1 row justify-content-start">'+
  144. '<label for="description" class="col-1 col-form-label">'+count+'</label>'+
  145. '<input type="hidden" id="progress" v-model="progress" value="+count+">'+
  146. '<div class="col-sm-9">'+
  147. '<input type="text" class="form-control" id="description" v-model="description">'+
  148. '</div>'+
  149. '<div class="col-sm-2">'+
  150. '<input type="currency" class="form-control" id="value" v-model="value">'+
  151. '</div>'+
  152. '</div>';
  153. return newrow;
  154. }
  155. var currencyInput = document.querySelector('input[type="currency"]')
  156. var currency = 'AUD' // https://www.currency-iso.org/dam/downloads/lists/list_one.xml
  157. // format inital value
  158. onBlur({target:currencyInput})
  159. // bind event listeners
  160. currencyInput.addEventListener('focus', onFocus)
  161. currencyInput.addEventListener('blur', onBlur)
  162. function localStringToNumber( s ){
  163. return Number(String(s).replace(/[^0-9.,-]+/g,""))
  164. }
  165. function onFocus(e){
  166. var value = e.target.value;
  167. e.target.value = value ? localStringToNumber(value) : ''
  168. }
  169. function onBlur(e){
  170. var value = e.target.value
  171. var options = {
  172. maximumFractionDigits : 2,
  173. currency : currency,
  174. style : "currency",
  175. currencyDisplay : "symbol"
  176. }
  177. e.target.value = (value || value === 0)
  178. ? localStringToNumber(value).toLocaleString(undefined, options)
  179. : ''
  180. }
  181. </script>
  182. <hr>
  183. <footer class="footer">
  184. <p class="text-center">&copy; <?php echo date('Y'); ?> - Modulos Design</p>
  185. </footer>
  186. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" crossorigin="anonymous"></script>
  187. <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB-QceOYrDe9otynMmQ9iNF3yEZzbpsanM&libraries=places&callback=initAutocomplete" async defer></script>
  188. <script src="https://cdn.jsdelivr.net/npm/signature_pad@4.0.0/dist/signature_pad.umd.min.js"></script>
  189. <script src="js/signature.js" ></script>
  190. <script async defer src="https://apis.google.com/js/api.js" onload="gapiLoaded()"></script>
  191. <script async defer src="https://accounts.google.com/gsi/client" onload="gisLoaded()"></script>
  192. </body>
  193. </html>