| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <?php /** @noinspection PhpUnhandledExceptionInspection */
- namespace App;
- use App\Helpers\HtmlHelper;
- /**
- * @var string $title
- * @var Product $product
- */
- $core = Core::getInstance();
- $user = $core->getUser();
- $request = Request::fromRequest();
- if($product->isNew()) {
- $supplier_id = $request->int("supplier_id");
- $new = 1;
- }
- else {
- $supplier_id = $product->supplier_id;
- $new = 0;
- }
- ?>
- <h3><?=htmlspecialchars($title)?></h3>
- <form method="post" enctype="multipart/form-data">
- <?php
- $user->insertCsrfToken();
- ?>
- <input type="hidden" id="new" value="<?=$new?>" />
- <div class="row">
- <div class="col-sm-6">
- <div class="mb-3">
- <label class="form-label" for="supplier-id"><?=htmlspecialchars(__("Supplier"))?></label>
- <select class="form-select" name="supplier_id" id="supplier-id" required>
- <option value=""><?=htmlspecialchars(__("Select Supplier"))?></option>
- <?php
- HtmlHelper::renderOptions(Supplier::getOptions(), $supplier_id);
- ?>
- </select>
- </div>
- </div>
- <div class="col-sm-6">
- <div class="mb-3">
- <label class="form-label" for="type"><?=htmlspecialchars(__("Type"))?></label>
- <select class="form-select" name="type" id="type" required>
- <?php
- foreach(Product::getTypeOptions() as $value => $display) {
- ?>
- <option value="<?=$value?>" <?=Html::selected($value, $product->type)?>>
- <?=htmlspecialchars($display)?>
- </option>
- <?php
- }
- ?>
- </select>
- </div>
- </div>
- </div>
- <div class="mb-3">
- <label class="form-label" for="name"><?=htmlspecialchars(__("Name"))?></label>
- <input class="form-control" type="text" id="name" name="name" placeholder="<?=htmlspecialchars(__("Type name"))?>" value="<?=htmlspecialchars($product->name)?>" maxlength="255" required />
- </div>
- <div class="row">
- <div class="col-6">
- <div class="mb-3">
- <label class="form-label" for="sku"><?=htmlspecialchars(__("SKU"))?></label>
- <input class="form-control" type="text" id="sku" name="sku" placeholder="<?=htmlspecialchars(__("Type SKU"))?>" value="<?=htmlspecialchars($product->sku)?>" maxlength="255" required />
- </div>
- </div>
- <div class="col-6">
- <div class="mb-3">
- <label class="form-label" for="price"><?=htmlspecialchars(__("Price"))?></label>
- <input class="form-control" type="number" id="price" name="price" placeholder="<?=htmlspecialchars(__("Type price"))?>" value="<?=htmlspecialchars($product->price)?>" min="0" max="999999.99" step="any" required />
- </div>
- </div>
- </div>
- <div class="mb-3">
- <label class="form-label" for="url"><?=htmlspecialchars(__("URL"))?></label>
- <input class="form-control" type="url" name="url" id="url" placeholder="<?=htmlspecialchars(__("Type URL"))?>" value="<?=htmlspecialchars($product->url)?>" />
- </div>
- <div class="mb-3">
- <label class="form-label" for="brochure">
- <?=htmlspecialchars(__("Upload Brochure (PDF)"))?>
- </label>
- <input class="form-control" type="file" name="brochure" id="brochure" accept="application/pdf" />
- <?php
- if($product->hasBrochure()) {
- ?>
- <div class="form-check">
- <input class="form-check-input" type="checkbox" name="delete_brochure" id="delete-brochure" value="1" />
- <label class="form-check-label" for="delete-brochure"><?=htmlspecialchars(__("Delete Brochure"))?></label>
- </div>
- <?php
- }
- ?>
- </div>
- <div class="mb-3">
- <div class="form-check">
- <input class="form-check-input" type="checkbox" id="archived" name="archived" value="1" <?=HtmlHelper::checked($product->archived)?> />
- <label class="form-check-label" for="archived"><?=htmlspecialchars(__("Archived"))?></label>
- </div>
- </div>
- <div class="mb-3">
- <button class="btn btn-primary" type="submit" name="submit" value="1">
- <?=htmlspecialchars(__("Submit"))?>
- </button>
- </div>
- </form>
|