| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- namespace App;
- /**
- * @var string $title
- * @var Product $product
- */
- $core = Core::getInstance();
- $user = $core->getUser();
- $suppliers = Supplier::getAll();
- $request = Request::fromRequest();
- if($product->isNew()) {
- $supplier_id = $request->int("supplier_id");
- }
- else {
- $supplier_id = $product->supplier_id;
- }
- ?>
- <h3><?=htmlspecialchars($title)?></h3>
- <form method="post">
- <?php
- $user->insertCsrfToken();
- ?>
- <div class="mb-3">
- <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
- foreach($suppliers as $supplier) {
- ?>
- <option value="<?=$supplier->id?>" <?=Html::selected($supplier->id, $supplier_id)?>>
- <?=htmlspecialchars($supplier->name)?>
- </option>
- <?php
- }
- ?>
- </select>
- </div>
- <div class="mb-3">
- <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="mb-3">
- <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 class="row">
- <div class="col-6">
- <div class="mb-3">
- <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 class="col-6">
- <div class="mb-3">
- <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">
- <button class="btn btn-primary" type="submit" name="submit" value="1">
- <?=htmlspecialchars(__("Submit"))?>
- </button>
- </div>
- </form>
|