new_document.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php /** @noinspection PhpUnhandledExceptionInspection */
  2. namespace App;
  3. use App\Helpers\HtmlHelper;
  4. $core = Core::getInstance();
  5. $settings = $core->getSettings();
  6. $products = Product::query([], ["sort" => "name"]);
  7. ?>
  8. <div class="modal fade" role="dialog" tabindex="-1" data-backdrop="static" id="new-document-modal">
  9. <div class="modal-dialog modal-lg">
  10. <form class="modal-content" method="post" action="/documents/submit">
  11. <?php
  12. View::include("modals/header", ["title" => __("New Document")]);
  13. ?>
  14. <input type="hidden" name="ticket_id" value="" />
  15. <div class="modal-body">
  16. <div class="mb-3">
  17. <label class="form-label" for="new-document-company-id"><?= htmlspecialchars(__("Company")) ?></label>
  18. <select class="form-select" name="company_id" id="new-document-company-id" required>
  19. <option value=""><?=htmlspecialchars(__("Select Company"))?></option>
  20. <?php
  21. HtmlHelper::renderOptions(Company::getOptions(), $settings->defaultCompanyId ?? null);
  22. ?>
  23. </select>
  24. </div>
  25. <div class="mb-3">
  26. <label class="form-label" for="new-document-supplier-id"><?= htmlspecialchars(__("Supplier")) ?></label>
  27. <select class="form-select" name="supplier_id" id="new-document-supplier-id">
  28. <option value=""><?=htmlspecialchars(__("Select Supplier"))?></option>
  29. <?php
  30. foreach(Supplier::getAll() as $supplier) {
  31. ?>
  32. <option value="<?=$supplier->id?>">
  33. <?=htmlspecialchars($supplier->name)?>
  34. </option>
  35. <?php
  36. }
  37. ?>
  38. </select>
  39. </div>
  40. <div class="mb-3">
  41. <label class="form-label" for="new-document-location-id"><?= htmlspecialchars(__("Location")) ?></label>
  42. <select class="form-select" name="location_id" id="new-document-location-id">
  43. <option value=""><?=htmlspecialchars(__("Select Location"))?></option>
  44. <?php
  45. foreach(Customer::getAll() as $customer) {
  46. foreach($customer->getLocations() as $location) {
  47. ?>
  48. <option value="<?=$location->id?>">
  49. <?=htmlspecialchars($location->getDisplayName())?>
  50. </option>
  51. <?php
  52. }
  53. }
  54. ?>
  55. </select>
  56. </div>
  57. <section id="new-document-aru-section">
  58. <h5><?=htmlspecialchars(__("ARU Item"))?></h5>
  59. <p><?=htmlspecialchars(__("Enter details of the part that is being returned if known."))?></p>
  60. <div class="mb-3">
  61. <label class="form-label" for="new-document-product-lookup">
  62. <?=htmlspecialchars(__("Product Lookup"))?>
  63. </label>
  64. <select class="form-control" id="new-document-product-lookup" data-placeholder="<?=htmlspecialchars(__("Select Product"))?>">
  65. <option value=""></option>
  66. <?php
  67. foreach($products as $product) {
  68. ?>
  69. <option value="<?=$product->id?>" data-name="<?=htmlspecialchars($product->name)?>">
  70. <?=htmlspecialchars($product->name)?> / <?=htmlspecialchars($product->sku)?>
  71. </option>
  72. <?php
  73. }
  74. ?>
  75. </select>
  76. </div>
  77. <div class="mb-3">
  78. <label class="form-label" for="new-document-item-description">
  79. <?=htmlspecialchars(__("Description"))?>
  80. </label>
  81. <input class="form-control" type="text" name="item_description" id="new-document-item-description" maxlength="255" placeholder="<?=htmlspecialchars(__("Type description"))?>" />
  82. </div>
  83. <div class="mb-3">
  84. <label class="form-label" for="new-document-item-serial-number">
  85. <?=htmlspecialchars(__("Serial Numbers"))?>
  86. </label>
  87. <textarea class="form-control" type="text" name="item_serial_number" id="new-document-item-serial-number" maxlength="64000" placeholder="<?=htmlspecialchars(__("Type serial numbers"))?>"></textarea>
  88. </div>
  89. </section>
  90. </div>
  91. <div class="modal-footer">
  92. <button type="submit" class="btn btn-success">
  93. <?= htmlspecialchars(__("Submit")) ?>
  94. </button>
  95. </div>
  96. </form>
  97. </div>
  98. </div>