2018-04-11 19:49:35 +02:00
@ extends ( 'layout.default' )
2019-05-01 20:19:18 +02:00
@ section ( 'title' , $__t ( '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-10-01 20:20:50 +02:00
@ push ( 'pageStyles' )
< style >
. product - name - cell [ data - product - has - picture = 'true' ] {
cursor : pointer ;
}
</ style >
@ 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-10-27 17:26:00 +02:00
< h1 >@ yield ( 'title' )
< small id = " info-current-stock " class = " text-muted " ></ small >
< a class = " btn btn-outline-dark responsive-button " href = " { { $U ('/stockjournal') }} " >
2019-05-01 20:19:18 +02:00
< i class = " fas fa-file-alt " ></ i > {{ $__t ( 'Journal' ) }}
2018-10-27 17:26:00 +02:00
</ a >
2019-08-11 09:24:47 +02:00
< a class = " btn btn-outline-dark responsive-button " href = " { { $U ('/locationcontentsheet') }} " >
< i class = " fas fa-print " ></ i > {{ $__t ( 'Location Content Sheet' ) }}
</ a >
2018-10-27 17:26:00 +02:00
</ 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-11-24 19:40:50 +01:00
< div class = " col-xs-12 col-md-6 col-xl-3 " >
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-07-11 19:43:05 +02:00
< div class = " col-xs-12 col-md-6 col-xl-3 " >
2019-05-01 20:19:18 +02:00
< label for = " location-filter " > {{ $__t ( '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 " >
2019-05-01 20:19:18 +02:00
< option value = " all " > {{ $__t ( 'All' ) }} </ option >
2018-07-09 21:33:23 +02:00
@ foreach ( $locations as $location )
< option value = " { { $location->name }} " > {{ $location -> name }} </ option >
@ endforeach
</ select >
2017-04-20 17:10:21 +02:00
</ div >
2018-10-06 18:19:31 +02:00
< div class = " col-xs-12 col-md-6 col-xl-3 " >
2019-05-01 20:19:18 +02:00
< label for = " location-filter " > {{ $__t ( 'Filter by product group' ) }} </ label > < i class = " fas fa-filter " ></ i >
2018-10-06 18:19:31 +02:00
< select class = " form-control " id = " product-group-filter " >
2019-05-01 20:19:18 +02:00
< option value = " all " > {{ $__t ( 'All' ) }} </ option >
2018-10-06 18:19:31 +02:00
@ foreach ( $productGroups as $productGroup )
< option value = " { { $productGroup->name }} " > {{ $productGroup -> name }} </ option >
@ endforeach
</ select >
</ div >
2018-09-24 19:13:53 +02:00
< div class = " col-xs-12 col-md-6 col-xl-3 " >
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-warning " value = " expiring " > {{ $__t ( 'Expiring soon' ) }} </ option >
< option class = " bg-danger " value = " expired " > {{ $__t ( 'Already expired' ) }} </ option >
< option class = " bg-info " value = " belowminstockamount " > {{ $__t ( 'Below min. stock amount' ) }} </ option >
2018-09-24 19:13:53 +02:00
</ select >
</ 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 >
2019-03-09 10:49:26 +01:00
< th class = " border-right " ></ th >
2019-05-01 20:19:18 +02:00
< th > {{ $__t ( 'Product' ) }} </ th >
< th > {{ $__t ( 'Amount' ) }} </ th >
< th > {{ $__t ( '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-10-06 18:19:31 +02:00
< th class = " d-none " > Hidden product group </ th >
2019-04-22 22:16:35 +02:00
@ include ( 'components.userfields_thead' , array (
'userfields' => $userfields
))
2018-07-10 20:37:13 +02:00
</ tr >
</ thead >
2019-01-05 14:27:40 +01:00
< tbody class = " d-none " >
2018-07-10 20:37:13 +02:00
@ foreach ( $currentStock as $currentStockEntry )
2018-10-20 14:04:09 +02:00
< tr id = " product- { { $currentStockEntry->product_id }}-row " class = " @if( $currentStockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime('-1 days')) && $currentStockEntry->amount > 0) table-danger @elseif( $currentStockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime( " + $nextXDays days " )) && $currentStockEntry->amount > 0) table-warning @elseif (FindObjectInArrayByPropertyValue( $missingProducts , 'id', $currentStockEntry->product_id ) !== null) table-info @endif " >
2019-03-09 10:49:26 +01:00
< td class = " fit-content border-right " >
2019-05-05 14:13:50 +02:00
< a class = " btn btn-success btn-sm product-consume-button @if( $currentStockEntry->amount < 1) disabled @endif " href = " # " data - toggle = " tooltip " data - placement = " left " title = " { { $__t ('Consume %1 $s of %2 $s ', '1 ' . FindObjectInArrayByPropertyValue( $quantityunits , 'id', FindObjectInArrayByPropertyValue( $products , 'id', $currentStockEntry->product_id )->qu_id_stock)->name, 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 = " 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 >
2019-05-01 20:19:18 +02:00
< a id = " product- { { $currentStockEntry->product_id }}-consume-all-button " class = " btn btn-danger btn-sm product-consume-button @if( $currentStockEntry->amount == 0) disabled @endif " href = " # " data - toggle = " tooltip " data - placement = " right " title = " { { $__t ('Consume all %s 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 }} " >
2019-05-01 20:19:18 +02:00
< i class = " fas fa-utensils " ></ i > {{ $__t ( 'All' ) }}
2018-07-10 20:37:13 +02:00
</ a >
2019-05-05 14:13:50 +02:00
< a class = " btn btn-success btn-sm product-open-button @if( $currentStockEntry->amount < 1 || $currentStockEntry->amount == $currentStockEntry->amount_opened ) disabled @endif " href = " # " data - toggle = " tooltip " data - placement = " left " title = " { { $__t ('Mark %1 $s of %2 $s as open', '1 ' . FindObjectInArrayByPropertyValue( $quantityunits , 'id', FindObjectInArrayByPropertyValue( $products , 'id', $currentStockEntry->product_id )->qu_id_stock)->name, FindObjectInArrayByPropertyValue( $products , 'id', $currentStockEntry->product_id )->name) }} "
2018-11-17 19:39:37 +01: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 }} " >
< i class = " fas fa-box-open " ></ i > 1
</ a >
2019-03-09 13:11:50 +01:00
< div class = " dropdown d-inline-block " >
< button class = " btn btn-sm btn-light text-secondary " type = " button " data - toggle = " dropdown " >
< i class = " fas fa-ellipsis-v " ></ i >
</ button >
< div class = " dropdown-menu " >
< a class = " dropdown-item product-name-cell " data - product - id = " { { $currentStockEntry->product_id }} " type = " button " href = " # " >
2019-05-01 20:19:18 +02:00
< i class = " fas fa-info " ></ i > {{ $__t ( 'Show product details' ) }}
2019-03-09 13:11:50 +01:00
</ a >
< a class = " dropdown-item " type = " button " href = " { { $U ('/stockjournal?product=') }} { { $currentStockEntry->product_id }} " >
2019-05-01 20:19:18 +02:00
< i class = " fas fa-file-alt " ></ i > {{ $__t ( 'Stock journal for this product' ) }}
2019-03-09 13:11:50 +01:00
</ a >
< a class = " dropdown-item " type = " button " href = " { { $U ('/product/') }} { { $currentStockEntry->product_id }} " >
2019-05-01 20:19:18 +02:00
< i class = " fas fa-edit " ></ i > {{ $__t ( 'Edit product' ) }}
2019-03-09 13:11:50 +01:00
</ a >
2019-07-06 18:15:53 +02:00
< div class = " dropdown-divider " ></ div >
< a class = " dropdown-item product-consume-button product-consume-button-spoiled @if( $currentStockEntry->amount < 1) disabled @endif " type = " button " href = " # "
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 " >
< i class = " fas fa-utensils " ></ i > {{ $__t ( 'Consume %1$s of %2$s as spoiled' , '1 ' . FindObjectInArrayByPropertyValue ( $quantityunits , 'id' , FindObjectInArrayByPropertyValue ( $products , 'id' , $currentStockEntry -> product_id ) -> qu_id_stock ) -> name , FindObjectInArrayByPropertyValue ( $products , 'id' , $currentStockEntry -> product_id ) -> name ) }}
</ a >
2019-03-09 13:11:50 +01:00
</ div >
</ div >
2018-07-10 20:37:13 +02:00
</ td >
2018-11-24 19:40:50 +01:00
< td class = " product-name-cell cursor-link " data - product - id = " { { $currentStockEntry->product_id }} " >
2019-03-09 13:11:50 +01:00
{{ FindObjectInArrayByPropertyValue ( $products , 'id' , $currentStockEntry -> product_id ) -> name }}
2018-07-10 20:37:13 +02:00
</ td >
< td >
2019-07-06 13:13:38 +02:00
< span id = " product- { { $currentStockEntry->product_id }}-amount " > {{ $currentStockEntry -> amount }} </ span > < span id = " product- { { $currentStockEntry->product_id }}-qu-name " > {{ $__n ( $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 ) }} </ span >
2019-05-01 20:19:18 +02:00
< span id = " product- { { $currentStockEntry->product_id }}-opened-amount " class = " small font-italic " >@ if ( $currentStockEntry -> amount_opened > 0 ){{ $__t ( '%s opened' , $currentStockEntry -> amount_opened ) }} @ endif </ span >
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 >
2018-10-20 14:04:09 +02:00
< time id = " product- { { $currentStockEntry->product_id }}-next-best-before-date-timeago " class = " timeago timeago-contextual " datetime = " { { $currentStockEntry->best_before_date }} 23:59:59 " ></ time >
2018-07-10 20:37:13 +02:00
</ td >
2018-09-23 09:22:54 +02:00
< td class = " d-none " >
2019-03-01 20:25:01 +01:00
@ foreach ( FindAllObjectsInArrayByPropertyValue ( $currentStockLocations , 'product_id' , $currentStockEntry -> product_id ) as $locationsForProduct )
{{ FindObjectInArrayByPropertyValue ( $locations , 'id' , $locationsForProduct -> location_id ) -> name }}
@ endforeach
2018-07-10 20:37:13 +02:00
</ td >
2018-09-24 19:13:53 +02:00
< td class = " d-none " >
2019-04-05 18:41:21 +02:00
@ if ( $currentStockEntry -> best_before_date < date ( 'Y-m-d 23:59:59' , strtotime ( '-1 days' )) && $currentStockEntry -> amount > 0 ) expired @ elseif ( $currentStockEntry -> best_before_date < date ( 'Y-m-d 23:59:59' , strtotime ( " + $nextXDays days " )) && $currentStockEntry -> amount > 0 ) expiring @ endif @ if ( FindObjectInArrayByPropertyValue ( $missingProducts , 'id' , $currentStockEntry -> product_id ) !== null ) belowminstockamount @ endif
2018-09-24 19:13:53 +02:00
</ td >
2018-10-06 18:19:31 +02:00
@ php $productGroup = FindObjectInArrayByPropertyValue ( $productGroups , 'id' , FindObjectInArrayByPropertyValue ( $products , 'id' , $currentStockEntry -> product_id ) -> product_group_id ) @ endphp
< td class = " d-none " >
@ if ( $productGroup !== null ){{ $productGroup -> name }} @ endif
</ td >
2019-04-22 22:16:35 +02:00
@ include ( 'components.userfields_tbody' , array (
'userfields' => $userfields ,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue ( $userfieldValues , 'object_id' , $currentStockEntry -> product_id )
))
2018-07-10 20:37:13 +02:00
</ tr >
@ endforeach
</ tbody >
</ table >
</ div >
2017-04-15 23:16:20 +02:00
</ div >
2018-10-22 19:28:59 +02:00
< div class = " modal fade " id = " stockoverview-productcard-modal " tabindex = " -1 " >
< div class = " modal-dialog " >
< div class = " modal-content text-center " >
< div class = " modal-body " >
@ include ( 'components.productcard' )
</ div >
< div class = " modal-footer " >
2019-05-01 20:19:18 +02:00
< button type = " button " class = " btn btn-secondary " data - dismiss = " modal " > {{ $__t ( 'Close' ) }} </ button >
2018-10-22 19:28:59 +02:00
</ div >
</ div >
</ div >
</ div >
2018-04-11 19:49:35 +02:00
@ stop