2018-04-11 19:49:35 +02:00
@ extends ( 'layout.default' )
2019-05-01 20:19:18 +02:00
@ section ( 'title' , $__t ( 'Shopping list' ))
2018-04-12 21:13:38 +02:00
@ section ( 'activeNav' , 'shoppinglist' )
@ section ( 'viewJsName' , 'shoppinglist' )
2018-09-24 13:02:52 +02:00
@ push ( 'pageScripts' )
< script src = " { { $U ('/node_modules/jquery-ui-dist/jquery-ui.min.js?v=', true) }} { { $version }} " ></ script >
< 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 >
2018-11-17 14:50:52 +01:00
< script src = " { { $U ('/viewjs/purchase.js?v=', true) }} { { $version }} " ></ script >
2018-09-24 13:02:52 +02:00
@ endpush
@ push ( 'pageStyles' )
< link href = " { { $U ('/node_modules/datatables.net-rowgroup-bs4/css/rowGroup.bootstrap4.min.css?v=', true) }} { { $version }} " rel = " stylesheet " >
@ endpush
2018-04-11 19:49:35 +02:00
@ section ( 'content' )
2019-10-05 13:10:56 +02:00
@ if ( GROCY_FEATURE_FLAG_SHOPPINGLIST_MULTIPLE_LISTS )
2019-09-20 20:14:47 +02:00
< div class = " row border-bottom pb-2 mb-2 d-print-none " >
2019-04-20 17:04:40 +02:00
< div class = " col-xs-12 col-md-4 " >
2019-05-01 20:19:18 +02:00
< label for = " selected-shopping-list " > {{ $__t ( 'Selected shopping list' ) }} </ label >
2019-04-20 17:04:40 +02:00
< select class = " form-control " id = " selected-shopping-list " >
@ foreach ( $shoppingLists as $shoppingList )
< option @ if ( $shoppingList -> id == $selectedShoppingListId ) selected = " selected " @ endif value = " { { $shoppingList->id }} " > {{ $shoppingList -> name }} </ option >
@ endforeach
</ select >
</ div >
2019-09-20 17:40:45 +02:00
< div class = " col-xs-12 col-md-8 " >
2019-04-20 17:04:40 +02:00
< label for = " selected-shopping-list " >& nbsp ; </ label >< br >
< a class = " btn btn-outline-dark responsive-button " href = " { { $U ('/shoppinglist/new') }} " >
2019-05-01 20:19:18 +02:00
< i class = " fas fa-plus " ></ i > {{ $__t ( 'New shopping list' ) }}
2019-04-20 17:04:40 +02:00
</ a >
< a id = " delete-selected-shopping-list " class = " btn btn-outline-danger responsive-button @if( $selectedShoppingListId == 1) disabled @endif " href = " # " >
2019-05-01 20:19:18 +02:00
< i class = " fas fa-trash " ></ i > {{ $__t ( 'Delete shopping list' ) }}
2019-04-20 17:04:40 +02:00
</ a >
2019-09-20 18:13:38 +02:00
< a id = " print-shopping-list-button " class = " btn btn-outline-dark responsive-button " href = " # " >
< i class = " fas fa-print " ></ i > {{ $__t ( 'Print' ) }}
</ a >
<!--< div class = " dropdown d-inline-block " >
2019-09-20 17:40:45 +02:00
< 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 >
2019-09-20 18:13:38 +02:00
</ div >-->
2019-04-20 17:04:40 +02:00
</ div >
</ div >
2020-01-03 13:35:48 +01:00
@ else
< input type = " hidden " name = " selected-shopping-list " id = " selected-shopping-list " value = " 1 " >
2019-10-05 13:10:56 +02:00
@ endif
2019-04-20 17:04:40 +02:00
2019-09-20 20:14:47 +02:00
< div class = " row d-print-none " >
< div class = " col " >
< h1 >
@ yield ( 'title' )
< a class = " btn btn-outline-dark responsive-button " href = " { { $U ('/shoppinglistitem/new?list=' . $selectedShoppingListId ) }} " >
< i class = " fas fa-plus " ></ i > {{ $__t ( 'Add item' ) }}
</ a >
< a id = " clear-shopping-list " class = " btn btn-outline-danger responsive-button @if( $listItems->count () == 0) disabled @endif " href = " # " >
< i class = " fas fa-trash " ></ i > {{ $__t ( 'Clear list' ) }}
</ a >
< a id = " add-products-below-min-stock-amount " class = " btn btn-outline-primary responsive-button " href = " # " >
< i class = " fas fa-cart-plus " ></ i > {{ $__t ( 'Add products that are below defined min. stock amount' ) }}
</ a >
< a id = " add-all-items-to-stock-button " class = " btn btn-outline-primary responsive-button " href = " # " >
< i class = " fas fa-box " ></ i > {{ $__t ( 'Add all list items to stock' ) }}
</ a >
</ h1 >
< p data - status - filter = " belowminstockamount " class = " btn btn-lg btn-info status-filter-button responsive-button " > {{ $__n ( count ( $missingProducts ), '%s product is below defined min. stock amount' , '%s products are below defined min. stock amount' ) }} </ p >
</ div >
</ div >
2019-09-20 17:40:45 +02:00
< div class = " row mt-3 d-print-none " >
2018-11-24 19:40:50 +01:00
< div class = " col-xs-12 col-md-4 " >
2019-05-01 20:19:18 +02:00
< label for = " search " > {{ $__t ( 'Search' ) }} </ label > < i class = " fas fa-search " ></ i >
2018-11-24 19:40:50 +01:00
< input type = " text " class = " form-control " id = " search " >
</ div >
2018-09-24 19:13:53 +02:00
< div class = " col-xs-12 col-md-4 " >
2019-05-01 20:19:18 +02:00
< label for = " status-filter " > {{ $__t ( 'Filter by status' ) }} </ label > < i class = " fas fa-filter " ></ i >
2018-09-24 19:13:53 +02:00
< select class = " form-control " id = " status-filter " >
2019-05-01 20:19:18 +02:00
< option class = " bg-white " value = " all " > {{ $__t ( 'All' ) }} </ option >
< option class = " bg-info " value = " belowminstockamount " > {{ $__t ( 'Below min. stock amount' ) }} </ option >
2018-09-24 19:13:53 +02:00
</ select >
</ div >
</ div >
2018-07-09 19:27:22 +02:00
2019-09-20 17:40:45 +02:00
< div class = " row d-print-none " >
2018-09-24 19:13:53 +02:00
< div class = " col-xs-12 col-md-8 pb-3 " >
2018-07-10 20:37:13 +02:00
< table id = " shoppinglist-table " class = " table table-sm table-striped dt-responsive " >
< thead >
< tr >
2019-03-09 10:49:26 +01:00
< th class = " border-right " ></ th >
2019-05-01 20:19:18 +02:00
< th > {{ $__t ( 'Product' ) }} / < em > {{ $__t ( 'Note' ) }} </ em ></ th >
< th > {{ $__t ( 'Amount' ) }} </ th >
2018-09-24 13:02:52 +02:00
< th class = " d-none " > Hiden product group </ th >
2018-09-24 19:13:53 +02:00
< th class = " d-none " > Hidden status </ th >
2019-09-17 19:39:55 +02:00
@ include ( 'components.userfields_thead' , array (
'userfields' => $userfields
))
2018-07-10 20:37:13 +02:00
</ tr >
</ thead >
2019-01-05 20:06:35 +01:00
< tbody class = " d-none " >
2018-07-10 20:37:13 +02:00
@ foreach ( $listItems as $listItem )
2019-07-06 17:56:59 +02:00
< tr id = " shoppinglistitem- { { $listItem->id }}-row " class = " @if(FindObjectInArrayByPropertyValue( $missingProducts , 'id', $listItem->product_id ) !== null) table-info @endif @if( $listItem->done == 1) text-muted text-strike-through @endif " >
2019-03-09 10:49:26 +01:00
< td class = " fit-content border-right " >
2019-07-06 17:56:59 +02:00
< a class = " btn btn-success btn-sm order-listitem-button " href = " # "
data - item - id = " { { $listItem->id }} "
data - item - done = " { { $listItem->done }} " >
< i class = " fas fa-check " ></ i >
</ a >
2019-04-20 17:04:40 +02:00
< a class = " btn btn-sm btn-info " href = " { { $U ('/shoppinglistitem/') . $listItem->id . '?list=' . $selectedShoppingListId }} " >
2018-07-11 19:43:05 +02:00
< i class = " fas fa-edit " ></ i >
2018-07-10 20:37:13 +02:00
</ a >
2018-07-11 19:43:05 +02:00
< a class = " btn btn-sm btn-danger shoppinglist-delete-button " href = " # " data - shoppinglist - id = " { { $listItem->id }} " >
< i class = " fas fa-trash " ></ i >
2018-07-10 20:37:13 +02:00
</ a >
2019-05-05 14:13:50 +02:00
< a class = " btn btn-sm btn-primary @if(empty( $listItem->product_id )) disabled @else shopping-list-stock-add-workflow-list-item-button @endif " href = " { { $U ('/purchase?embedded&flow=shoppinglistitemtostock&product=') }} { { $listItem->product_id }}&amount= { { $listItem->amount }}&listitemid= { { $listItem->id }} " @ if ( ! empty ( $listItem -> product_id )) data - toggle = " tooltip " title = " { { $__t ('Add %1 $s of %2 $s to stock', $listItem->amount . ' ' . $__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), FindObjectInArrayByPropertyValue( $products , 'id', $listItem->product_id )->name, $listItem->amount ) }} " @ endif >
2018-11-14 21:40:17 +01:00
< i class = " fas fa-box " ></ i >
</ a >
2018-07-10 20:37:13 +02:00
</ td >
< td >
2018-10-27 10:39:52 +02:00
@ if ( ! empty ( $listItem -> product_id )) {{ FindObjectInArrayByPropertyValue ( $products , 'id' , $listItem -> product_id ) -> name }} < br >@ endif < em > { !! nl2br ( $listItem -> note ) !! } </ em >
2018-07-10 20:37:13 +02:00
</ td >
< td >
2019-09-26 15:25:30 +02:00
< span class = " locale-number locale-number-quantity-amount " > {{ $listItem -> amount }} </ span > @ 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
2018-07-10 20:37:13 +02:00
</ td >
2018-09-24 13:02:52 +02:00
< td class = " d-none " >
2019-05-01 20:19:18 +02:00
@ if ( ! empty ( FindObjectInArrayByPropertyValue ( $products , 'id' , $listItem -> product_id ) -> product_group_id )) {{ FindObjectInArrayByPropertyValue ( $productGroups , 'id' , FindObjectInArrayByPropertyValue ( $products , 'id' , $listItem -> product_id ) -> product_group_id ) -> name }} @ else < span class = " font-italic font-weight-light " > {{ $__t ( 'Ungrouped' ) }} </ span > @ endif
2018-09-24 13:02:52 +02:00
</ td >
2018-09-24 19:13:53 +02:00
< td class = " d-none " >
@ if ( FindObjectInArrayByPropertyValue ( $missingProducts , 'id' , $listItem -> product_id ) !== null ) belowminstockamount @ endif
</ td >
2019-09-17 19:39:55 +02:00
@ include ( 'components.userfields_tbody' , array (
'userfields' => $userfields ,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue ( $userfieldValues , 'object_id' , $listItem -> product_id )
))
2018-07-10 20:37:13 +02:00
</ tr >
@ endforeach
</ tbody >
</ table >
</ div >
2018-07-13 22:38:31 +02:00
2019-09-20 17:40:45 +02:00
< div class = " col-xs-12 col-md-4 mt-md-2 d-print-none " >
2018-07-13 22:38:31 +02:00
@ include ( 'components.calendarcard' )
</ div >
2017-04-21 15:36:04 +02:00
</ div >
2018-11-17 14:50:52 +01:00
2019-09-20 18:08:38 +02:00
< div class = " row mt-3 d-print-none " >
< div class = " col-xs-12 col-md-8 " >
< div class = " form-group " >
2019-09-21 08:38:28 +02:00
< label class = " text-larger font-weight-bold " for = " notes " > {{ $__t ( 'Notes' ) }} </ label >
2019-09-28 08:48:58 +02:00
< a id = " save-description-button " class = " btn btn-success btn-sm ml-1 mb-2 " href = " # " > {{ $__t ( 'Save' ) }} </ a >
< a id = " clear-description-button " class = " btn btn-danger btn-sm ml-1 mb-2 " href = " # " > {{ $__t ( 'Clear' ) }} </ a >
2019-09-20 18:08:38 +02:00
< textarea class = " form-control wysiwyg-editor " id = " description " name = " description " > {{ FindObjectInArrayByPropertyValue ( $shoppingLists , 'id' , $selectedShoppingListId ) -> description }} </ textarea >
</ div >
</ div >
</ div >
2018-11-17 14:50:52 +01:00
< div class = " modal fade " id = " shopping-list-stock-add-workflow-modal " tabindex = " -1 " >
< div class = " modal-dialog " >
< div class = " modal-content text-center " >
< div class = " modal-body " >
< iframe id = " shopping-list-stock-add-workflow-purchase-form-frame " class = " embed-responsive " src = " " ></ iframe >
</ div >
2018-11-18 14:19:50 +01:00
< div class = " modal-footer " >
< span id = " shopping-list-stock-add-workflow-purchase-item-count " class = " d-none mr-auto " ></ span >
2019-05-01 20:19:18 +02:00
< button id = " shopping-list-stock-add-workflow-skip-button " type = " button " class = " btn btn-primary " >< i class = " fas fa-angle-double-right " ></ i > {{ $__t ( 'Skip' ) }} </ button >
< button type = " button " class = " btn btn-secondary " data - dismiss = " modal " > {{ $__t ( 'Close' ) }} </ button >
2018-11-17 14:50:52 +01:00
</ div >
</ div >
</ div >
</ div >
2019-09-20 17:40:45 +02:00
< 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 >
2019-09-20 18:08:38 +02:00
< div class = " row w-75 " >
< div class = " col " >
< h5 > {{ $__t ( 'Notes' ) }} </ h5 >
< p id = " description-for-print " ></ p >
</ div >
</ div >
2019-09-20 17:40:45 +02:00
</ div >
2018-04-11 19:49:35 +02:00
@ stop