new_sale.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace App;
  3. use App\Helpers\HtmlHelper;
  4. /**
  5. * @var Customer $customer
  6. */
  7. $customers = isset($customer) ? [$customer] : Customer::getAll();
  8. $request = Request::fromRequest();
  9. $core = Core::getInstance();
  10. $settings = $core->getSettings();
  11. $default_company_id = $settings->defaultCompanyId ?? null;
  12. $default_location_id = $request->int("add_location_id");
  13. $location_options = [];
  14. foreach($customers as $customer) {
  15. foreach($customer->getLocations() as $location) {
  16. $location_options[$location->id] = $location->getDisplayName();
  17. }
  18. }
  19. ?>
  20. <div class="modal fade" role="dialog" tabindex="-1" data-backdrop="static" id="new-sale-modal">
  21. <div class="modal-dialog modal-lg">
  22. <form class="modal-content" method="post" action="/leads/submit">
  23. <?php
  24. View::include("modals/header", ["title" => __("New Lead")]);
  25. ?>
  26. <div class="modal-body">
  27. <div class="mb-3">
  28. <label for="new-sale-company-id" class="form-label">
  29. <?=htmlspecialchars(__("Company"))?>
  30. </label>
  31. <select class="form-select" name="company_id" id="new-sale-company-id" required>
  32. <option value=""><?=htmlspecialchars(__("Select Company"))?></option>
  33. <?php
  34. HtmlHelper::renderOptions(Company::getOptions(), $default_company_id);
  35. ?>
  36. </select>
  37. </div>
  38. <div class="mb-3">
  39. <label class="form-label" for="new-sale-location-id"><?= htmlspecialchars(__("Location")) ?></label>
  40. <select class="form-select" name="location_id" id="new-sale-location-id">
  41. <?php
  42. HtmlHelper::renderOptions($location_options, $default_location_id);
  43. ?>
  44. </select>
  45. </div>
  46. <div class="mb-3">
  47. <label class="form-label" for="date-predicted-sold"><?=htmlspecialchars(__("Predicted Sold Date"))?></label>
  48. <input class="form-control" type="date" name="date_predicted_sold" id="date-predicted-sold" placeholder="<?=htmlspecialchars(__("Predicted Sold Date"))?>" required />
  49. </div>
  50. </div>
  51. <div class="modal-footer">
  52. <button type="submit" class="btn btn-success">
  53. <?= htmlspecialchars(__("Submit")) ?>
  54. </button>
  55. </div>
  56. </form>
  57. </div>
  58. </div>