Files
grocy/views/shoppinglistitemform.blade.php
fipwmaqzufheoxq92ebc a85998dd40 Improvements (#1049)
* Fixes #1035: Check available amount after filtering by stock_entry_id

* Fixes #1036: Remove stock-related buttons/options from Shopping-list  if FEATURE_FLAG_STOCK is disabled

* Fixes #1010: Repair recipe-picture upload.

* Fixes #958: Disable auto-reload of equipments-page.

* Fix uncaught exception in locationpicker.js

* Fixes #761 and #762: Add "Remove exact amount" for products with tare weight handling and use it for recipe-consumption.

* Fixes #1048: Repair product-group-filter on "Master Data"/Products

* Renamed variable

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-10-14 17:48:37 +02:00

93 lines
2.4 KiB
PHP

@extends('layout.default')
@if($mode == 'edit')
@section('title', $__t('Edit shopping list item'))
@else
@section('title', $__t('Create shopping list item'))
@endif
@section('viewJsName', 'shoppinglistitemform')
@section('content')
<div class="row">
<div class="col">
<h2 class="title">@yield('title')</h2>
<hr>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-6 col-xl-4 pb-3">
<script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit')
<script>
Grocy.EditObjectId = {{ $listItem->id }};
</script>
@endif
<form id="shoppinglist-form"
novalidate>
@if(GROCY_FEATURE_FLAG_SHOPPINGLIST_MULTIPLE_LISTS)
<div class="form-group">
<label for="shopping_list_id">{{ $__t('Shopping list') }}</label>
<select class="form-control"
id="shopping_list_id"
name="shopping_list_id">
@foreach($shoppingLists as $shoppingList)
<option @if($mode=='edit'
&&
$shoppingList->id == $listItem->shopping_list_id) selected="selected" @endif value="{{ $shoppingList->id }}">{{ $shoppingList->name }}</option>
@endforeach
</select>
</div>
@else
<input type="hidden"
id="shopping_list_id"
name="shopping_list_id"
value="1">
@endif
<div class="@if(!GROCY_FEATURE_FLAG_STOCK) d-none @endif" >
@php if($mode == 'edit') { $productId = $listItem->product_id; } else { $productId = ''; } @endphp
@include('components.productpicker', array(
'products' => $products,
'nextInputSelector' => '#amount',
'isRequired' => false,
'prefillById' => $productId
))
</div>
@php if($mode == 'edit') { $value = $listItem->amount; } else { $value = 1; } @endphp
@include('components.numberpicker', array(
'id' => 'amount',
'label' => 'Amount',
'hintId' => 'amount_qu_unit',
'min' => 0.01,
'step' => 0.01,
'value' => $value,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '0.01')
))
<div class="form-group">
<label for="note">{{ $__t('Note') }}</label>
<textarea class="form-control"
rows="2"
id="note"
name="note">@if($mode == 'edit'){{ $listItem->note }}@endif</textarea>
</div>
<button id="save-shoppinglist-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form>
</div>
@if(GROCY_FEATURE_FLAG_STOCK)
<div class="col-xs-12 col-md-6 col-xl-4 hide-when-embedded">
@include('components.productcard')
</div>
@endif
</div>
@stop