mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
Added an option to print a shopping list (references #245)
This commit is contained in:
parent
292b652437
commit
5a91c86b81
@ -1490,11 +1490,5 @@ msgstr ""
|
|||||||
msgid "Added %1$s of %2$s to the shopping list \"%3$s\""
|
msgid "Added %1$s of %2$s to the shopping list \"%3$s\""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "datatables_loc"
|
msgid "Output"
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "{}"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "{}}"
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -303,3 +303,9 @@ function OnListItemRemoved()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
OnListItemRemoved();
|
OnListItemRemoved();
|
||||||
|
|
||||||
|
$(document).on("click", "#print-shopping-list-button", function(e)
|
||||||
|
{
|
||||||
|
$(".print-timestamp").text(moment().format("l LT"));
|
||||||
|
window.print();
|
||||||
|
});
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="row">
|
<div class="row d-print-none">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<h1>
|
<h1>
|
||||||
@yield('title')
|
@yield('title')
|
||||||
@ -37,7 +37,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mt-3 border-top border-bottom py-2">
|
<div class="row mt-3 border-top border-bottom py-2 d-print-none">
|
||||||
<div class="col-xs-12 col-md-4">
|
<div class="col-xs-12 col-md-4">
|
||||||
<label for="selected-shopping-list">{{ $__t('Selected shopping list') }}</label>
|
<label for="selected-shopping-list">{{ $__t('Selected shopping list') }}</label>
|
||||||
<select class="form-control" id="selected-shopping-list">
|
<select class="form-control" id="selected-shopping-list">
|
||||||
@ -46,7 +46,7 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-md-4">
|
<div class="col-xs-12 col-md-8">
|
||||||
<label for="selected-shopping-list"> </label><br>
|
<label for="selected-shopping-list"> </label><br>
|
||||||
<a class="btn btn-outline-dark responsive-button" href="{{ $U('/shoppinglist/new') }}">
|
<a class="btn btn-outline-dark responsive-button" href="{{ $U('/shoppinglist/new') }}">
|
||||||
<i class="fas fa-plus"></i> {{ $__t('New shopping list') }}
|
<i class="fas fa-plus"></i> {{ $__t('New shopping list') }}
|
||||||
@ -54,10 +54,16 @@
|
|||||||
<a id="delete-selected-shopping-list" class="btn btn-outline-danger responsive-button @if($selectedShoppingListId == 1) disabled @endif" href="#">
|
<a id="delete-selected-shopping-list" class="btn btn-outline-danger responsive-button @if($selectedShoppingListId == 1) disabled @endif" href="#">
|
||||||
<i class="fas fa-trash"></i> {{ $__t('Delete shopping list') }}
|
<i class="fas fa-trash"></i> {{ $__t('Delete shopping list') }}
|
||||||
</a>
|
</a>
|
||||||
|
<div class="dropdown d-inline-block">
|
||||||
|
<button class="btn btn-outline-dark responsive-button dropdown-toggle" data-toggle="dropdown"><i class="fas fa-file-export"></i> {{ $__t('Output') }}</button>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<a id="print-shopping-list-button" class="dropdown-item" href="#"><i class="fas fa-print"></i> {{ $__t('Print') }}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mt-3">
|
<div class="row mt-3 d-print-none">
|
||||||
<div class="col-xs-12 col-md-4">
|
<div class="col-xs-12 col-md-4">
|
||||||
<label for="search">{{ $__t('Search') }}</label> <i class="fas fa-search"></i>
|
<label for="search">{{ $__t('Search') }}</label> <i class="fas fa-search"></i>
|
||||||
<input type="text" class="form-control" id="search">
|
<input type="text" class="form-control" id="search">
|
||||||
@ -71,7 +77,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row d-print-none">
|
||||||
<div class="col-xs-12 col-md-8 pb-3">
|
<div class="col-xs-12 col-md-8 pb-3">
|
||||||
<table id="shoppinglist-table" class="table table-sm table-striped dt-responsive">
|
<table id="shoppinglist-table" class="table table-sm table-striped dt-responsive">
|
||||||
<thead>
|
<thead>
|
||||||
@ -131,7 +137,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-xs-12 col-md-4 mt-md-2">
|
<div class="col-xs-12 col-md-4 mt-md-2 d-print-none">
|
||||||
@include('components.calendarcard')
|
@include('components.calendarcard')
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -150,4 +156,44 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="d-none d-print-block">
|
||||||
|
<h1 class="text-center">
|
||||||
|
<img src="{{ $U('/img/grocy_logo.svg?v=', true) }}{{ $version }}" height="30" class="d-print-flex mx-auto">
|
||||||
|
{{ $__t("Shopping list") }}
|
||||||
|
</h1>
|
||||||
|
@if (FindObjectInArrayByPropertyValue($shoppingLists, 'id', $selectedShoppingListId)->name != $__t("Shopping list"))
|
||||||
|
<h3 class="text-center">
|
||||||
|
{{ FindObjectInArrayByPropertyValue($shoppingLists, 'id', $selectedShoppingListId)->name }}
|
||||||
|
</h3>
|
||||||
|
@endif
|
||||||
|
<h6 class="text-center mb-4">
|
||||||
|
{{ $__t('Time of printing') }}:
|
||||||
|
<span class="d-inline print-timestamp"></span>
|
||||||
|
</h6>
|
||||||
|
<div class="row w-75">
|
||||||
|
<div class="col">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{ $__t('Product') }} / <em>{{ $__t('Note') }}</em></th>
|
||||||
|
<th>{{ $__t('Amount') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($listItems as $listItem)
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@if(!empty($listItem->product_id)) {{ FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->name }}<br>@endif<em>{!! nl2br($listItem->note) !!}</em>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ $listItem->amount }} @if(!empty($listItem->product_id)){{ $__n($listItem->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->qu_id_purchase)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->qu_id_purchase)->name_plural) }}@endif
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@stop
|
@stop
|
||||||
|
Loading…
x
Reference in New Issue
Block a user