mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Finalize nested recipes / group recipe positions feature (closes #77)
This commit is contained in:
parent
3e6cf545d7
commit
da98efa833
@ -23,7 +23,7 @@ class RecipesController extends BaseController
|
||||
if (isset($request->getQueryParams()['recipe']))
|
||||
{
|
||||
$selectedRecipe = $this->Database->recipes($request->getQueryParams()['recipe']);
|
||||
$selectedRecipePositions = $this->Database->recipes_pos()->where('recipe_id', $request->getQueryParams()['recipe']);
|
||||
$selectedRecipePositions = $this->Database->recipes_pos()->where('recipe_id', $request->getQueryParams()['recipe'])->orderBy('ingredient_group');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -284,6 +284,8 @@ return array(
|
||||
'A recipe is required' => 'Ein Rezept ist erforderlich',
|
||||
'Add included recipe' => 'Enthaltenes Rezept hinzufügen',
|
||||
'Edit included recipe' => 'Enthaltenes Rezept bearbeiten',
|
||||
'Group' => 'Gruppe',
|
||||
'This will be used as a headline to group ingredients together' => 'Dies wird als Überschrift verwendet, um Zutaten zusammenzufassen',
|
||||
|
||||
//Constants
|
||||
'manually' => 'Manuell',
|
||||
@ -376,5 +378,7 @@ return array(
|
||||
'Milk' => 'Milch',
|
||||
'Chocolate sauce' => 'Schokoladensoße',
|
||||
'Milliliters' => 'Milliliter',
|
||||
'Milliliter' => 'Milliliter'
|
||||
'Milliliter' => 'Milliliter',
|
||||
'Bottom' => 'Boden',
|
||||
'Topping' => 'Belag'
|
||||
);
|
||||
|
@ -17,8 +17,10 @@
|
||||
var recipesPosTables = $('#recipes-pos-table').DataTable({
|
||||
'paginate': false,
|
||||
'order': [[1, 'asc']],
|
||||
"orderFixed": [[4, 'asc']],
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 }
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'visible': false, 'targets': 4 }
|
||||
],
|
||||
'language': JSON.parse(L('datatables_localization')),
|
||||
'scrollY': false,
|
||||
@ -32,6 +34,9 @@ var recipesPosTables = $('#recipes-pos-table').DataTable({
|
||||
{
|
||||
column.search.search = "";
|
||||
});
|
||||
},
|
||||
'rowGroup': {
|
||||
dataSrc: 4
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -78,10 +78,10 @@ class DemoDataGeneratorService extends BaseService
|
||||
INSERT INTO recipes (name, description) VALUES ('{$localizationService->Localize('Chocolate sauce')}', '{$loremIpsumWithHtmlFormattings}'); --5
|
||||
INSERT INTO recipes (name, description) VALUES ('{$localizationService->Localize('Pancakes')} / {$localizationService->Localize('Chocolate sauce')}', '{$loremIpsumWithHtmlFormattings}'); --6
|
||||
|
||||
INSERT INTO recipes_pos (recipe_id, product_id, amount) VALUES (1, 16, 1);
|
||||
INSERT INTO recipes_pos (recipe_id, product_id, amount) VALUES (1, 17, 1);
|
||||
INSERT INTO recipes_pos (recipe_id, product_id, amount, note) VALUES (1, 18, 1, '{$localizationService->Localize('This is the note content of the recipe ingredient')}');
|
||||
INSERT INTO recipes_pos (recipe_id, product_id, amount) VALUES (1, 10, 1);
|
||||
INSERT INTO recipes_pos (recipe_id, product_id, amount, ingredient_group) VALUES (1, 16, 1, '{$localizationService->Localize('Bottom')}');
|
||||
INSERT INTO recipes_pos (recipe_id, product_id, amount, ingredient_group) VALUES (1, 17, 1, '{$localizationService->Localize('Topping')}');
|
||||
INSERT INTO recipes_pos (recipe_id, product_id, amount, note, ingredient_group) VALUES (1, 18, 1, '{$localizationService->Localize('This is the note content of the recipe ingredient')}', '{$localizationService->Localize('Topping')}');
|
||||
INSERT INTO recipes_pos (recipe_id, product_id, amount, ingredient_group) VALUES (1, 10, 1, '{$localizationService->Localize('Bottom')}');
|
||||
INSERT INTO recipes_pos (recipe_id, product_id, amount) VALUES (2, 6, 1);
|
||||
INSERT INTO recipes_pos (recipe_id, product_id, amount) VALUES (2, 10, 1);
|
||||
INSERT INTO recipes_pos (recipe_id, product_id, amount, note) VALUES (2, 17, 1, '{$localizationService->Localize('This is the note content of the recipe ingredient')}');
|
||||
|
@ -11,10 +11,13 @@
|
||||
@push('pageScripts')
|
||||
<script src="{{ $U('/node_modules/summernote/dist/summernote-bs4.js?v=', true) }}{{ $version }}"></script>
|
||||
@if(!empty($L('summernote_locale')))<script src="{{ $U('/node_modules', true) }}/summernote/dist/lang/summernote-{{ $L('summernote_locale') }}.js?v={{ $version }}"></script>@endif
|
||||
<script src="{{ $U('/node_modules/datatables.net-rowgroup/js/dataTables.rowGroup.min.js?v=', true) }}{{ $version }}"></script>
|
||||
<script src="{{ $U('/node_modules/datatables.net-rowgroup-bs4/js/rowGroup.bootstrap4.min.js?v=', true) }}{{ $version }}"></script>
|
||||
@endpush
|
||||
|
||||
@push('pageStyles')
|
||||
<link href="{{ $U('/node_modules/summernote/dist/summernote-bs4.css?v=', true) }}{{ $version }}" rel="stylesheet">
|
||||
<link href="{{ $U('/node_modules/datatables.net-rowgroup-bs4/css/rowGroup.bootstrap4.min.css?v=', true) }}{{ $version }}" rel="stylesheet">
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
@ -66,6 +69,7 @@
|
||||
<th>{{ $L('Product') }}</th>
|
||||
<th>{{ $L('Amount') }}</th>
|
||||
<th>{{ $L('Note') }}</th>
|
||||
<th class="d-none">Hiden ingredient group</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -95,6 +99,9 @@
|
||||
<i class="fas fa-eye"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ $recipePosition->ingredient_group }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
|
@ -69,7 +69,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="ingredient_group">{{ $L('Group') }}</label>
|
||||
<label for="ingredient_group">{{ $L('Group') }} <span class="small text-muted">{{ $L('This will be used as a headline to group ingredients together') }}</span></label>
|
||||
<input type="text" class="form-control" id="ingredient_group" name="ingredient_group" value="@if($mode == 'edit'){{ $recipePos->ingredient_group }}@endif">
|
||||
</div>
|
||||
|
||||
|
@ -75,7 +75,11 @@
|
||||
<h5 class="mb-0">{{ $L('Ingredients') }}</h5>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
@php $lastGroup = 'undefined'; @endphp
|
||||
@foreach($selectedRecipeSubRecipePositionsFiltered as $selectedRecipePosition)
|
||||
@if($lastGroup != $selectedRecipePosition->ingredient_group)
|
||||
<h5 class="mb-2 mt-2 ml-4"><strong>{{ $selectedRecipePosition->ingredient_group }}</strong></h5>
|
||||
@endif
|
||||
<li class="list-group-item">
|
||||
{{ $selectedRecipePosition->amount }} {{ Pluralize($selectedRecipePosition->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', $selectedRecipePosition->qu_id)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', $selectedRecipePosition->qu_id)->name_plural) }} {{ FindObjectInArrayByPropertyValue($products, 'id', $selectedRecipePosition->product_id)->name }}
|
||||
<span class="timeago-contextual">@if(FindObjectInArrayByPropertyValue($recipesFulfillment, 'recipe_pos_id', $selectedRecipePosition->id)->need_fulfilled == 1) {{ $L('Enough in stock') }} @else {{ $L('Not enough in stock, #1 missing, #2 already on shopping list', FindObjectInArrayByPropertyValue($recipesFulfillment, 'recipe_pos_id', $selectedRecipePosition->id)->missing_amount, FindObjectInArrayByPropertyValue($recipesFulfillment, 'recipe_pos_id', $selectedRecipePosition->id)->amount_on_shopping_list) }} @endif</span>
|
||||
@ -84,6 +88,7 @@
|
||||
<div class="text-muted">{{ $selectedRecipePosition->note }}</div>
|
||||
@endif
|
||||
</li>
|
||||
@php $lastGroup = $selectedRecipePosition->ingredient_group; @endphp
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
@ -104,7 +109,7 @@
|
||||
@php $lastGroup = 'undefined'; @endphp
|
||||
@foreach($selectedRecipePositions as $selectedRecipePosition)
|
||||
@if($lastGroup != $selectedRecipePosition->ingredient_group)
|
||||
<h5 class="mb-2 mt-4 ml-4"><strong>{{ $selectedRecipePosition->ingredient_group }}</strong></h5>
|
||||
<h5 class="mb-2 mt-2 ml-4"><strong>{{ $selectedRecipePosition->ingredient_group }}</strong></h5>
|
||||
@endif
|
||||
<li class="list-group-item">
|
||||
{{ $selectedRecipePosition->amount }} {{ Pluralize($selectedRecipePosition->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', $selectedRecipePosition->qu_id)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', $selectedRecipePosition->qu_id)->name_plural) }} {{ FindObjectInArrayByPropertyValue($products, 'id', $selectedRecipePosition->product_id)->name }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user