2018-04-11 19:49:35 +02:00
@ extends ( 'layout.default' )
2018-04-16 19:11:32 +02:00
@ section ( 'title' , $L ( 'Stock overview' ))
2018-04-12 21:13:38 +02:00
@ section ( 'activeNav' , 'stockoverview' )
@ section ( 'viewJsName' , 'stockoverview' )
2018-05-13 08:42:45 +02:00
@ push ( 'pageScripts' )
2018-07-08 21:36:07 +02:00
< script src = " { { $U ('/node_modules/jquery-ui-dist/jquery-ui.min.js?v=', true) }} { { $version }} " ></ script >
2018-05-13 08:42:45 +02:00
@ endpush
2018-04-11 19:49:35 +02:00
@ section ( 'content' )
2018-07-09 21:33:23 +02:00
< div class = " row " >
2018-07-10 00:07:38 +02:00
< div class = " col " >
2018-08-04 14:25:32 +02:00
< h1 >@ yield ( 'title' ) < small id = " info-current-stock " class = " text-muted " ></ small ></ h1 >
2018-09-24 19:13:53 +02:00
< p id = " info-expiring-products " data - next - x - days = " { { $nextXDays }} " data - status - filter = " expiring " class = " btn btn-lg btn-warning status-filter-button responsive-button mr-2 " ></ p >
< p id = " info-expired-products " data - status - filter = " expired " class = " btn btn-lg btn-danger status-filter-button responsive-button mr-2 " ></ p >
< p id = " info-missing-products " data - status - filter = " belowminstockamount " class = " btn btn-lg btn-info status-filter-button responsive-button " ></ p >
2018-07-10 00:07:38 +02:00
</ div >
2018-07-09 21:33:23 +02:00
</ div >
2017-04-20 17:10:21 +02:00
2018-07-09 21:33:23 +02:00
< div class = " row mt-3 " >
2018-07-11 19:43:05 +02:00
< div class = " col-xs-12 col-md-6 col-xl-3 " >
2018-07-12 19:12:31 +02:00
< label for = " location-filter " > {{ $L ( 'Filter by location' ) }} </ label > < i class = " fas fa-filter " ></ i >
2018-07-09 21:33:23 +02:00
< select class = " form-control " id = " location-filter " >
< option value = " all " > {{ $L ( 'All' ) }} </ option >
@ foreach ( $locations as $location )
< option value = " { { $location->name }} " > {{ $location -> name }} </ option >
@ endforeach
</ select >
2017-04-20 17:10:21 +02:00
</ div >
2018-09-24 19:13:53 +02:00
< div class = " col-xs-12 col-md-6 col-xl-3 " >
< label for = " status-filter " > {{ $L ( 'Filter by status' ) }} </ label > < i class = " fas fa-filter " ></ i >
< select class = " form-control " id = " status-filter " >
< option class = " bg-white " value = " all " > {{ $L ( 'All' ) }} </ option >
< option class = " bg-warning " value = " expiring " > {{ $L ( 'Expiring soon' ) }} </ option >
< option class = " bg-danger " value = " expired " > {{ $L ( 'Already expired' ) }} </ option >
< option class = " bg-info " value = " belowminstockamount " > {{ $L ( 'Below min. stock amount' ) }} </ option >
</ select >
</ div >
2018-07-11 19:43:05 +02:00
< div class = " col-xs-12 col-md-6 col-xl-3 " >
2018-07-12 19:12:31 +02:00
< label for = " search " > {{ $L ( 'Search' ) }} </ label > < i class = " fas fa-search " ></ i >
2018-07-09 21:33:23 +02:00
< input type = " text " class = " form-control " id = " search " >
2018-07-08 16:54:37 +02:00
</ div >
2018-05-12 14:25:21 +02:00
</ div >
2017-04-20 17:10:21 +02:00
2018-07-10 20:37:13 +02:00
< div class = " row " >
< div class = " col " >
< table id = " stock-overview-table " class = " table table-sm table-striped dt-responsive " >
< thead >
< tr >
< th > #</th>
< th > {{ $L ( 'Product' ) }} </ th >
< th > {{ $L ( 'Amount' ) }} </ th >
< th > {{ $L ( 'Next best before date' ) }} </ th >
2018-09-23 09:22:54 +02:00
< th class = " d-none " > Hidden location </ th >
2018-09-24 19:13:53 +02:00
< th class = " d-none " > Hidden status </ th >
2018-07-10 20:37:13 +02:00
</ tr >
</ thead >
< tbody >
@ foreach ( $currentStock as $currentStockEntry )
2018-08-04 14:25:32 +02:00
< tr id = " product- { { $currentStockEntry->product_id }}-row " class = " @if( $currentStockEntry->best_before_date < date('Y-m-d', strtotime('-1 days'))) table-danger @elseif( $currentStockEntry->best_before_date < date('Y-m-d', strtotime( " + $nextXDays days " ))) table-warning @elseif (FindObjectInArrayByPropertyValue( $missingProducts , 'id', $currentStockEntry->product_id ) !== null) table-info @endif " >
2018-07-10 20:37:13 +02:00
< td class = " fit-content " >
2018-09-25 16:24:43 +02:00
< a class = " btn btn-success btn-sm product-consume-button " href = " # " data - toggle = " tooltip " data - placement = " left " title = " { { $L ('Consume #3 #1 of #2', FindObjectInArrayByPropertyValue( $quantityunits , 'id', FindObjectInArrayByPropertyValue( $products , 'id', $currentStockEntry->product_id )->qu_id_stock)->name, FindObjectInArrayByPropertyValue( $products , 'id', $currentStockEntry->product_id )->name, 1) }} "
2018-07-10 20:37:13 +02:00
data - product - id = " { { $currentStockEntry->product_id }} "
data - product - name = " { { FindObjectInArrayByPropertyValue( $products , 'id', $currentStockEntry->product_id )->name }} "
data - product - qu - name = " { { FindObjectInArrayByPropertyValue( $quantityunits , 'id', FindObjectInArrayByPropertyValue( $products , 'id', $currentStockEntry->product_id )->qu_id_stock)->name }} "
data - consume - amount = " 1 " >
2018-07-11 19:43:05 +02:00
< i class = " fas fa-utensils " ></ i > 1
2018-07-10 20:37:13 +02:00
</ a >
2018-09-25 16:24:43 +02:00
< a id = " product- { { $currentStockEntry->product_id }}-consume-all-button " class = " btn btn-danger btn-sm product-consume-button " href = " # " data - toggle = " tooltip " data - placement = " right " title = " { { $L ('Consume all #1 which are currently in stock', FindObjectInArrayByPropertyValue( $products , 'id', $currentStockEntry->product_id )->name) }} "
2018-07-10 20:37:13 +02:00
data - product - id = " { { $currentStockEntry->product_id }} "
data - product - name = " { { FindObjectInArrayByPropertyValue( $products , 'id', $currentStockEntry->product_id )->name }} "
data - product - qu - name = " { { FindObjectInArrayByPropertyValue( $quantityunits , 'id', FindObjectInArrayByPropertyValue( $products , 'id', $currentStockEntry->product_id )->qu_id_stock)->name }} "
data - consume - amount = " { { $currentStockEntry->amount }} " >
2018-07-11 19:43:05 +02:00
< i class = " fas fa-utensils " ></ i > {{ $L ( 'All' ) }}
2018-07-10 20:37:13 +02:00
</ a >
</ td >
< td >
{{ FindObjectInArrayByPropertyValue ( $products , 'id' , $currentStockEntry -> product_id ) -> name }}
</ td >
< td >
2018-07-27 19:39:34 +02:00
< span id = " product- { { $currentStockEntry->product_id }}-amount " > {{ $currentStockEntry -> amount }} </ span > {{ Pluralize ( $currentStockEntry -> amount , FindObjectInArrayByPropertyValue ( $quantityunits , 'id' , FindObjectInArrayByPropertyValue ( $products , 'id' , $currentStockEntry -> product_id ) -> qu_id_stock ) -> name , FindObjectInArrayByPropertyValue ( $quantityunits , 'id' , FindObjectInArrayByPropertyValue ( $products , 'id' , $currentStockEntry -> product_id ) -> qu_id_stock ) -> name_plural ) }}
2018-07-10 20:37:13 +02:00
</ td >
< td >
2018-08-07 20:11:08 +02:00
< span id = " product- { { $currentStockEntry->product_id }}-next-best-before-date " > {{ $currentStockEntry -> best_before_date }} </ span >
< time id = " product- { { $currentStockEntry->product_id }}-next-best-before-date-timeago " class = " timeago timeago-contextual " datetime = " { { $currentStockEntry->best_before_date }} " ></ time >
2018-07-10 20:37:13 +02:00
</ td >
2018-09-23 09:22:54 +02:00
< td class = " d-none " >
2018-07-10 20:37:13 +02:00
{{ FindObjectInArrayByPropertyValue ( $locations , 'id' , FindObjectInArrayByPropertyValue ( $products , 'id' , $currentStockEntry -> product_id ) -> location_id ) -> name }}
</ td >
2018-09-24 19:13:53 +02:00
< td class = " d-none " >
@ if ( $currentStockEntry -> best_before_date < date ( 'Y-m-d' , strtotime ( '-1 days' ))) expired @ elseif ( $currentStockEntry -> best_before_date < date ( 'Y-m-d' , strtotime ( " + $nextXDays days " ))) expiring @ elseif ( FindObjectInArrayByPropertyValue ( $missingProducts , 'id' , $currentStockEntry -> product_id ) !== null ) belowminstockamount @ endif
</ td >
2018-07-10 20:37:13 +02:00
</ tr >
@ endforeach
</ tbody >
</ table >
</ div >
2017-04-15 23:16:20 +02:00
</ div >
2018-04-11 19:49:35 +02:00
@ stop