new_sale.php 1.7 KB

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