Reorganize project part 3

This commit is contained in:
Bernd Bestel
2018-04-12 21:13:38 +02:00
parent 7dcd39f82f
commit 5a1d21ef31
86 changed files with 625 additions and 583 deletions

View File

@@ -1,38 +1,46 @@
@extends('layout.default')
@if($mode == 'edit')
@section('title', 'Edit shopping list item')
@else
@section('title', 'Create shopping list item')
@endif
@section('viewJsName', 'shoppinglistform')
@section('content')
<div class="col-sm-3 col-sm-offset-3 col-md-3 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 $listItem->id; ?>;</script>
<?php endif; ?>
@if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $listItem->id }};</script>
@endif
<form id="shoppinglist-form">
<div class="form-group">
<label for="product_id">Product&nbsp;&nbsp;<i class="fa fa-barcode"></i></label>
<select class="form-control combobox" id="product_id" name="product_id" value="<?php if ($mode == 'edit') echo $listItem->product_id; ?>">
<select class="form-control combobox" id="product_id" name="product_id" value="@if($mode == 'edit') {{ $listItem->product_id }} @endif">
<option value=""></option>
<?php foreach ($products as $product) : ?>
<option <?php if ($mode == 'edit' && $product->id == $listItem->product_id) echo 'selected="selected"'; ?> data-additional-searchdata="<?php echo $product->barcode; ?>" value="<?php echo $product->id; ?>"><?php echo $product->name; ?></option>
<?php endforeach; ?>
@foreach($products as $product)
<option @if($mode == 'edit' && $product->id == $listItem->product_id) selected="selected" @endif data-additional-searchdata="{{ $product->barcode }}" value="{{ $product->id }}">{{ $product->name }}</option>
@endforeach
</select>
<div id="product-error" class="help-block with-errors"></div>
</div>
<div class="form-group">
<label for="amount">Amount&nbsp;&nbsp;<span id="amount_qu_unit" class="small text-muted"></span><br><span class="small text-warning"><?php if ($mode == 'edit' && $listItem->amount_autoadded > 0) echo $listItem->amount_autoadded . " units were automatically added and will apply in addition to the amount entered here."; ?></span></label>
<input type="number" class="form-control" id="amount" name="amount" value="<?php if ($mode == 'edit') echo $listItem->amount; else echo '1'; ?>" min="0" required>
<label for="amount">Amount&nbsp;&nbsp;<span id="amount_qu_unit" class="small text-muted"></span><br><span class="small text-warning">@if($mode == 'edit' && $listItem->amount_autoadded > 0){{ $listItem->amount_autoadded }} units were automatically added and will apply in addition to the amount entered here.@endif</span></label>
<input type="number" class="form-control" id="amount" name="amount" value="@if($mode == 'edit'){{ $listItem->amount }}@else{{1}}@endif" min="0" required>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<label for="note">Note</label>
<textarea class="form-control" rows="2" id="note" name="note"><?php if ($mode == 'edit') echo $listItem->note; ?></textarea>
<textarea class="form-control" rows="2" id="note" name="note">@if($mode == 'edit'){{ $listItem->note }}@endif</textarea>
</div>
<button id="save-shoppinglist-button" type="submit" class="btn btn-default">Save</button>