mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 12:20:22 +00:00
Reorganize project part 3
This commit is contained in:
@@ -1,27 +1,35 @@
|
||||
@extends('layout.default')
|
||||
|
||||
@if($mode == 'edit')
|
||||
@section('title', 'Edit product')
|
||||
@else
|
||||
@section('title', 'Create product')
|
||||
@endif
|
||||
|
||||
@section('viewJsName', 'productform')
|
||||
|
||||
@section('content')
|
||||
<div class="col-sm-3 col-sm-offset-3 col-md-4 col-md-offset-2 main">
|
||||
|
||||
<h1 class="page-header"><?php echo $title; ?></h1>
|
||||
<h1 class="page-header">@yield('title')</h1>
|
||||
|
||||
<script>Grocy.EditMode = '<?php echo $mode; ?>';</script>
|
||||
<script>Grocy.EditMode = '{{ $mode }}';</script>
|
||||
|
||||
<?php if ($mode == 'edit') : ?>
|
||||
<script>Grocy.EditObjectId = <?php echo $product->id; ?>;</script>
|
||||
<?php endif; ?>
|
||||
@if($mode == 'edit')
|
||||
<script>Grocy.EditObjectId = {{ $product->id }};</script>
|
||||
@endif
|
||||
|
||||
<form id="product-form">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="name">Name</label>
|
||||
<input type="text" class="form-control" required id="name" name="name" value="<?php if ($mode == 'edit') echo $product->name; ?>">
|
||||
<input type="text" class="form-control" required id="name" name="name" value="@if($mode == 'edit'){{ $product->name}}@endif">
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="description">Description</label>
|
||||
<textarea class="form-control" rows="2" id="description" name="description"><?php if ($mode == 'edit') echo $product->description; ?></textarea>
|
||||
<textarea class="form-control" rows="2" id="description" name="description">@if($mode == 'edit'){{ $product->description }}@endif</textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group tm-group">
|
||||
@@ -33,31 +41,31 @@
|
||||
<div class="form-group">
|
||||
<label for="location_id">Location</label>
|
||||
<select required class="form-control" id="location_id" name="location_id">
|
||||
<?php foreach ($locations as $location) : ?>
|
||||
<option <?php if ($mode == 'edit' && $location->id == $product->location_id) echo 'selected="selected"'; ?> value="<?php echo $location->id; ?>"><?php echo $location->name; ?></option>
|
||||
<?php endforeach; ?>
|
||||
@foreach($locations as $location)
|
||||
<option @if($mode == 'edit' && $location->id == $product->location_id) selected="selected" @endif value="{{ $location->id }}">{{ $location->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="min_stock_amount">Minimum stock amount</label>
|
||||
<input required min="0" type="number" class="form-control" id="min_stock_amount" name="min_stock_amount" value="<?php if ($mode == 'edit') echo $product->min_stock_amount; else echo '0'; ?>">
|
||||
<input required min="0" type="number" class="form-control" id="min_stock_amount" name="min_stock_amount" value="@if($mode == 'edit'){{ $product->min_stock_amount }}@else{{0}}@endif">
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="default_best_before_days">Default best before days<br><span class="small text-muted">For purchases this amount of days will be added to today for the best before date suggestion</span></label>
|
||||
<input required min="0" type="number" class="form-control" id="default_best_before_days" name="default_best_before_days" value="<?php if ($mode == 'edit') echo $product->default_best_before_days; else echo '0'; ?>">
|
||||
<input required min="0" type="number" class="form-control" id="default_best_before_days" name="default_best_before_days" value="@if($mode == 'edit'){{ $product->default_best_before_days }}@else{{0}}@endif">
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="qu_id_purchase">Quantity unit purchase</label>
|
||||
<select required class="form-control input-group-qu" id="qu_id_purchase" name="qu_id_purchase">
|
||||
<?php foreach ($quantityunits as $quantityunit) : ?>
|
||||
<option <?php if ($mode == 'edit' && $quantityunit->id == $product->qu_id_purchase) echo 'selected="selected"'; ?> value="<?php echo $quantityunit->id; ?>"><?php echo $quantityunit->name; ?></option>
|
||||
<?php endforeach; ?>
|
||||
@foreach($quantityunits as $quantityunit)
|
||||
<option @if($mode == 'edit' && $quantityunit->id == $product->qu_id_purchase) selected="selected" @endif value="{{ $quantityunit->id }}">{{ $quantityunit->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
@@ -65,16 +73,16 @@
|
||||
<div class="form-group">
|
||||
<label for="qu_id_stock">Quantity unit stock</label>
|
||||
<select required class="form-control input-group-qu" id="qu_id_stock" name="qu_id_stock">
|
||||
<?php foreach ($quantityunits as $quantityunit) : ?>
|
||||
<option <?php if ($mode == 'edit' && $quantityunit->id == $product->qu_id_stock) echo 'selected="selected"'; ?> value="<?php echo $quantityunit->id; ?>"><?php echo $quantityunit->name; ?></option>
|
||||
<?php endforeach; ?>
|
||||
@foreach($quantityunits as $quantityunit)
|
||||
<option @if($mode == 'edit' && $quantityunit->id == $product->qu_id_stock) selected="selected" @endif value="{{ $quantityunit->id }}">{{ $quantityunit->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="qu_factor_purchase_to_stock">Factor purchase to stock quantity unit</label>
|
||||
<input required min="1" type="number" class="form-control input-group-qu" id="qu_factor_purchase_to_stock" name="qu_factor_purchase_to_stock" value="<?php if ($mode == 'edit') echo $product->qu_factor_purchase_to_stock; else echo '1'; ?>">
|
||||
<input required min="1" type="number" class="form-control input-group-qu" id="qu_factor_purchase_to_stock" name="qu_factor_purchase_to_stock" value="@if ($mode == 'edit'){{ $product->qu_factor_purchase_to_stock }}@else{{1}}@endif">
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
|
||||
|
Reference in New Issue
Block a user