customer_form.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. /**
  3. * @var Customer $customer
  4. * @var string $page_title
  5. */
  6. ?>
  7. <div class="container mt-3 py-4">
  8. <h2><?=htmlspecialchars($page_title)?></h2>
  9. <form method="post">
  10. <div class="row form-group">
  11. <label class="col-sm-4 col-form-label" for="name">Name</label>
  12. <div class="col-sm">
  13. <input class="form-control" type="text" name="name" id="name" placeholder="Enter name" value="<?=htmlspecialchars($customer->name)?>" required />
  14. </div>
  15. </div>
  16. <div class="row form-group">
  17. <label class="col-sm-4 col-form-label" for="address-1">Address Line 1</label>
  18. <div class="col-sm">
  19. <input class="form-control" type="text" name="address_1" id="address-1" placeholder="Enter address line 1" value="<?=htmlspecialchars($customer->address_1)?>" />
  20. </div>
  21. </div>
  22. <div class="row form-group">
  23. <label class="col-sm-4 col-form-label" for="address-2">Address Line 2</label>
  24. <div class="col-sm">
  25. <input class="form-control" type="text" name="address_2" id="address-2" placeholder="Enter address line 2" value="<?=htmlspecialchars($customer->address_2)?>" />
  26. </div>
  27. </div>
  28. <div class="row form-group">
  29. <label class="col-sm-4 col-form-label" for="city">City</label>
  30. <div class="col-sm">
  31. <input class="form-control" type="text" name="city" id="city" placeholder="Enter city" value="<?=htmlspecialchars($customer->city)?>" />
  32. </div>
  33. </div>
  34. <div class="row form-group">
  35. <label class="col-sm-4 col-form-label" for="county">County</label>
  36. <div class="col-sm">
  37. <input class="form-control" type="text" name="county" id="county" placeholder="Enter county" value="<?=htmlspecialchars($customer->county)?>" />
  38. </div>
  39. </div>
  40. <div class="row form-group">
  41. <label class="col-sm-4 col-form-label" for="postal-code">Postal Code</label>
  42. <div class="col-sm">
  43. <input class="form-control" type="text" name="postal_code" id="postal-code" placeholder="Enter postal code" value="<?=htmlspecialchars($customer->postal_code)?>" />
  44. </div>
  45. </div>
  46. <div class="row form-group">
  47. <label class="col-sm-4 col-form-label" for="country">Country</label>
  48. <div class="col-sm">
  49. <select class="form-control" name="country" id="country">
  50. <?php
  51. Form::renderCountryOptions($customer->country);
  52. ?>
  53. </select>
  54. </div>
  55. </div>
  56. <div class="row form-group">
  57. <label class="col-sm-4 col-form-label" for="email">Email Address</label>
  58. <div class="col-sm">
  59. <input class="form-control" type="email" name="email" id="email" placeholder="Enter email address" value="<?=htmlspecialchars($customer->email)?>" />
  60. </div>
  61. </div>
  62. <div class="row form-group">
  63. <label class="col-sm-4 col-form-label" for="phone">Contact Number</label>
  64. <div class="col-sm">
  65. <input class="form-control" type="text" name="phone" id="phone" placeholder="Enter contact number" value="<?=htmlspecialchars($customer->phone)?>" />
  66. </div>
  67. </div>
  68. <div class="row form-group">
  69. <label class="col-sm-4 col-form-label" for="invoice-contact-name">Invoice Contact Name</label>
  70. <div class="col-sm">
  71. <input class="form-control" type="text" name="invoice_contact_name" id="invoice-contact-name" placeholder="Enter invoice contact name" value="<?=htmlspecialchars($customer->invoice_contact_name)?>" />
  72. </div>
  73. </div>
  74. <div class="row form-group">
  75. <label class="col-sm-4 col-form-label" for="year-cycle-month">
  76. Year Cycle Month
  77. </label>
  78. <div class="col-sm">
  79. <select class="form-control" name="year_cycle_month" id="year-cycle-month">
  80. <option value="">Select Month</option>
  81. <?php
  82. foreach(range(1, 12) as $month) {
  83. $display_month = sprintf("%02d", $month);
  84. $selected = ((int) $customer->year_cycle_month === $month) ? "selected" : "";
  85. ?>
  86. <option value="<?=$month?>" <?=$selected?>><?=$display_month?></option>
  87. <?php
  88. }
  89. ?>
  90. </select>
  91. </div>
  92. </div>
  93. <div class="row form-group">
  94. <label class="col-sm-4 col-form-label" for="config-json">
  95. Config JSON
  96. </label>
  97. <div class="col-sm">
  98. <textarea class="form-control text-monospace" name="config_json" id="config-json" rows="8"><?=htmlspecialchars($customer->config_json)?></textarea>
  99. </div>
  100. </div>
  101. <div class="row my-3">
  102. <div class="col-sm offset-sm-4">
  103. <div class="form-check">
  104. <input class="form-check-input" type="checkbox" name="show_in_map_overview" id="show-in-map-overview" value="1" <?=Form::checked($customer->show_in_map_overview)?> />
  105. <label for="show-in-map-overview">Show in Map Overview</label>
  106. </div>
  107. <div class="form-check">
  108. <input class="form-check-input" type="checkbox" name="email_after_test" id="email-after-test" value="1" <?=Form::checked($customer->email_after_test)?> />
  109. <label for="email-after-test">Email After Test</label>
  110. </div>
  111. <div class="form-check">
  112. <input class="form-check-input" type="checkbox" name="email_locations_after_test" id="email-locations-after-test" value="1" <?=Form::checked($customer->email_locations_after_test)?> />
  113. <label for="email-locations-after-test">Email to Locations After Test</label>
  114. </div>
  115. <button class="btn btn-primary" type="submit" name="submit" value="<?=$_SESSION["csrf_token"]?>">Submit</button>
  116. </div>
  117. </div>
  118. </form>
  119. </div>