draft_page.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /* -------------------------------------------------------------------------- */
  3. /* CONFIGURATION */
  4. /* -------------------------------------------------------------------------- */
  5. date_default_timezone_set("Australia/Hobart");
  6. error_reporting(E_ALL);
  7. ini_set('display_errors', '0');
  8. ini_set('log_errors', '1');
  9. require_once 'connection.php';
  10. include_once "dompdf/vendor/autoload.php";
  11. use Dompdf\Dompdf;
  12. use Dompdf\Options;
  13. if (session_status() !== PHP_SESSION_ACTIVE) session_start();
  14. if (empty($_SESSION['csrf'])) $_SESSION['csrf'] = bin2hex(random_bytes(16));
  15. $csrf = $_SESSION['csrf'];
  16. #$enquiry_date = date("l dS M 'y");
  17. $drg = $_GET['drg'] ?? '';
  18. if (!empty($_GET['drg'])) {
  19. include "table.php";
  20. }
  21. /* New: toggle PDF mode */
  22. $asPdf = isset($_GET['pdf']);
  23. /* If we are about to generate a PDF, start buffering the HTML now */
  24. if ($asPdf) {
  25. ob_start();
  26. }
  27. ?>
  28. <!doctype html>
  29. <html lang="en">
  30. <head>
  31. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  32. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  33. <title><?= htmlspecialchars($drg) ?> - Site Drafting</title>
  34. <link rel="shortcut icon" href="images/blueprint.ico" type="image/x-icon">
  35. <link href="css/bootstrap.css" rel="stylesheet">
  36. <link href="css/blueprint.css" rel="stylesheet">
  37. <link href="css/print.css" rel="stylesheet" media="print">
  38. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
  39. <!-- jQuery first, then Popper.js, then Bootstrap JS -->
  40. <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
  41. <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
  42. <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
  43. <script type="text/javascript" src="https://use.fontawesome.com/1e2844bb90.js"></script>
  44. <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js" integrity="sha256-T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=" crossorigin="anonymous"></script>
  45. </head>
  46. <body style="background-color:#fff !important;">
  47. <?php if (!$asPdf): ?>
  48. <nav class="navbar bg-brown-dark brown-light border-bottom border-body d-print-none" data-bs-theme="dark">
  49. <div class="container-fluid">
  50. <a class="navbar-brand brown-light" href="dashboard.php">
  51. <img src="images/blueprint-logo-light.png" alt="Logo" width="30" height="24" class="d-inline-block align-text-top">
  52. Modulos Design
  53. </a>
  54. <div class="ms-auto d-flex gap-2">
  55. <a href="dashboard.php" class="btn btn-sm btn-outline-light"><i class="bi bi-grid-fill"></i> Dashboard</a>
  56. <?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; ?>
  57. </div>
  58. </div>
  59. </nav>
  60. <?php endif; ?>
  61. <div class="container border border-3 border-dark vh-100">
  62. <div class="row mt-2">
  63. <div class="col align-self-start">
  64. <p class="mb-0"><?= htmlspecialchars(($firstname ?? '') . ' ' . ($lastname ?? '')) ?> - <?= htmlspecialchars($client_mobile ?? '') ?></p>
  65. <p class="mb-0"><?= htmlspecialchars($site_address ?? '') ?></p>
  66. </div>
  67. <div class="col-2 align-self-end text-end">
  68. <h1 class="mb-0 fw-bold"><?= htmlspecialchars($drg) ?></h1>
  69. </div>
  70. </div>
  71. <hr class="">
  72. <div class="row">
  73. <div class="col">
  74. </div>
  75. </div>
  76. </div>
  77. </body>
  78. </html>