2018-04-11 19:49:35 +02:00
@ extends ( 'layout.default' )
2019-05-01 20:19:18 +02:00
@ section ( 'title' , $__t ( 'Purchase' ))
2018-04-12 21:13:38 +02:00
@ section ( 'activeNav' , 'purchase' )
@ section ( 'viewJsName' , 'purchase' )
2020-01-26 15:35:01 +01:00
@ push ( 'pageScripts' )
2020-08-31 20:32:50 +02:00
< script src = "{{ $U ('/js/grocy_uisound.js?v=', true) }}{{ $version }}" ></ script >
2020-01-26 15:35:01 +01:00
@ endpush
2018-04-11 19:49:35 +02:00
@ section ( 'content' )
2020-11-09 19:25:46 +01:00
< script >
Grocy . QuantityUnits = { !! json_encode ( $quantityUnits ) !! };
Grocy . QuantityUnitConversionsResolved = { !! json_encode ( $quantityUnitConversionsResolved ) !! };
2020-12-23 19:56:37 +01:00
Grocy . DefaultMinAmount = '{{$DEFAULT_MIN_AMOUNT}}' ;
2020-11-09 19:25:46 +01:00
</ script >
2018-07-10 20:37:13 +02:00
< div class = "row" >
2020-11-16 19:10:29 +01:00
< div class = "col-xs-12 col-md-6 col-xl-4 pb-3" >
2020-04-19 08:51:02 -04:00
< div class = "title-related-links" >
< h2 class = "title" >@ yield ( 'title' ) </ h2 >
2020-11-08 15:09:10 +01:00
< button class = "btn btn-outline-dark d-md-none mt-2 float-right order-1 order-md-3 hide-when-embedded"
2020-11-07 14:53:45 +01:00
type = "button"
data - toggle = "collapse"
data - target = "#related-links" >
< i class = "fas fa-ellipsis-v" ></ i >
</ button >
< div class = "related-links collapse d-md-flex order-2 width-xs-sm-100"
id = "related-links" >
2020-04-19 08:51:02 -04:00
@ if ( ! $embedded )
2020-08-31 20:32:50 +02:00
< button id = "scan-mode-button"
2020-11-07 14:53:45 +01:00
class = "btn @if(boolval( $userSettings['scan_mode_purchase_enabled'] )) btn-success @else btn-danger @endif m-1 mt-md-0 mb-md-0 float-right"
2020-11-15 09:27:07 +01:00
data - toggle = "tooltip"
title = "{{ $__t ('When enabled, the amount will always be filled with 1 after changing/scanning a product and if all fields could be automatically populated (by product defaults), the transaction is automatically submitted') }}" > {{ $__t ( 'Scan mode' ) }} < span id = "scan-mode-status" >@ if ( boolval ( $userSettings [ 'scan_mode_purchase_enabled' ])) {{ $__t ( 'on' ) }} @ else {{ $__t ( 'off' ) }} @ endif </ span ></ button >
2020-08-31 20:32:50 +02:00
< input id = "scan-mode"
type = "checkbox"
class = "d-none user-setting-control"
data - setting - key = "scan_mode_purchase_enabled"
@ if ( boolval ( $userSettings [ 'scan_mode_purchase_enabled' ]))
checked
@ endif >
2020-04-19 08:51:02 -04:00
@ else
< script >
Grocy . UserSettings . scan_mode_purchase_enabled = false ;
</ script >
@ endif
</ div >
</ div >
2020-10-31 18:37:10 +01:00
2020-11-08 15:09:10 +01:00
< hr class = "my-2" >
2018-07-10 20:37:13 +02:00
2020-08-31 20:32:50 +02:00
< form id = "purchase-form"
novalidate >
2018-07-10 20:37:13 +02:00
2018-07-14 14:43:57 +02:00
@ include ( 'components.productpicker' , array (
2020-08-31 20:32:50 +02:00
'products' => $products ,
'barcodes' => $barcodes ,
2020-11-09 19:25:46 +01:00
'nextInputSelector' => '#display_amount'
2018-07-14 14:43:57 +02:00
))
2018-07-10 20:37:13 +02:00
2020-11-09 19:25:46 +01:00
@ include ( 'components.productamountpicker' , array (
'value' => 1 ,
2020-08-31 20:32:50 +02:00
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info"
class="text-info font-italic d-none">' . $__t ( 'Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated' ) . '</div>'
2020-04-22 10:38:24 -05:00
))
2020-03-25 19:34:56 +01:00
2020-10-17 11:03:47 +02:00
@ if ( boolval ( $userSettings [ 'show_purchased_date_on_purchase' ]))
2020-10-17 03:54:10 -05:00
@ include ( 'components.datetimepicker2' , array (
'id' => 'purchased_date' ,
'label' => 'Purchased date' ,
'format' => 'YYYY-MM-DD' ,
'initWithNow' => true ,
'limitEndToNow' => false ,
'limitStartToNow' => false ,
2020-10-17 11:03:47 +02:00
'invalidFeedback' => $__t ( 'A purchased date is required' ),
2020-10-17 03:54:10 -05:00
'nextInputSelector' => '#best_before_date' ,
'additionalCssClasses' => 'date-only-datetimepicker2' ,
'activateNumberPad' => GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD
))
@ endif
2020-09-14 11:15:11 +02:00
@ if ( GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING )
2018-07-12 19:12:31 +02:00
@ include ( 'components.datetimepicker' , array (
2020-08-31 20:32:50 +02:00
'id' => 'best_before_date' ,
2020-11-15 19:53:44 +01:00
'label' => 'Due date' ,
2020-08-31 20:32:50 +02:00
'format' => 'YYYY-MM-DD' ,
'initWithNow' => false ,
'limitEndToNow' => false ,
'limitStartToNow' => false ,
2020-11-15 19:53:44 +01:00
'invalidFeedback' => $__t ( 'A due date is required' ),
2020-08-31 20:32:50 +02:00
'nextInputSelector' => '#price' ,
'additionalCssClasses' => 'date-only-datetimepicker' ,
'shortcutValue' => '2999-12-31' ,
2020-11-15 19:53:44 +01:00
'shortcutLabel' => 'Never overdue' ,
2020-08-31 20:32:50 +02:00
'earlierThanInfoLimit' => date ( 'Y-m-d' ),
'earlierThanInfoText' => $__t ( 'The given date is earlier than today, are you sure?' ),
'activateNumberPad' => GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD
2018-07-10 20:37:13 +02:00
))
2020-09-14 11:15:11 +02:00
@ endif
2018-07-10 20:37:13 +02:00
2019-09-19 17:46:52 +02:00
@ if ( GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING )
2018-09-08 12:04:31 +02:00
@ include ( 'components.numberpicker' , array (
2020-08-31 20:32:50 +02:00
'id' => 'price' ,
'label' => 'Price' ,
2020-12-23 19:56:37 +01:00
'min' => '0.' . str_repeat ( '0' , $userSettings [ 'stock_decimal_places_prices' ]),
2020-10-20 13:08:54 -05:00
'decimals' => $userSettings [ 'stock_decimal_places_prices' ],
2020-08-31 20:32:50 +02:00
'value' => '' ,
2020-11-10 18:11:33 +01:00
'contextInfoId' => 'price-hint' ,
2020-08-31 20:32:50 +02:00
'isRequired' => false ,
2020-11-15 14:15:09 +01:00
'additionalGroupCssClasses' => 'mb-1' ,
'additionalCssClasses' => 'locale-number-input locale-number-currency'
2018-09-08 12:04:31 +02:00
))
2020-10-20 13:08:54 -05:00
2020-11-15 19:53:44 +01:00
< div class = "custom-control custom-radio custom-control-inline mt-n2 mb-3" >
< input class = "custom-control-input"
2020-08-31 20:32:50 +02:00
type = "radio"
name = "price-type"
id = "price-type-unit-price"
value = "unit-price"
checked >
2020-11-15 19:53:44 +01:00
< label class = "custom-control-label"
2020-11-10 18:11:33 +01:00
for = "price-type-unit-price" > {{ $__t ( 'Unit price' ) }} </ label >
2019-09-27 13:50:16 +02:00
</ div >
2020-11-15 19:53:44 +01:00
< div class = "custom-control custom-radio custom-control-inline mt-n2 mb-3" >
< input class = "custom-control-input"
2020-08-31 20:32:50 +02:00
type = "radio"
name = "price-type"
id = "price-type-total-price"
value = "total-price" >
2020-11-15 19:53:44 +01:00
< label class = "custom-control-label"
2020-08-31 20:32:50 +02:00
for = "price-type-total-price" > {{ $__t ( 'Total price' ) }} </ label >
2019-09-27 13:50:16 +02:00
</ div >
2020-03-25 19:34:56 +01:00
@ include ( 'components.shoppinglocationpicker' , array (
2020-08-31 20:32:50 +02:00
'label' => 'Store' ,
'shoppinglocations' => $shoppinglocations
2020-03-25 19:34:56 +01:00
))
2019-09-19 17:46:52 +02:00
@ else
2020-08-31 20:32:50 +02:00
< input type = "hidden"
name = "price"
id = "price"
value = "0" >
2019-09-19 17:46:52 +02:00
@ endif
2018-07-26 20:27:38 +02:00
2019-09-19 17:46:52 +02:00
@ if ( GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING )
2019-03-04 17:43:12 +01:00
@ include ( 'components.locationpicker' , array (
2020-08-31 20:32:50 +02:00
'locations' => $locations ,
'isRequired' => false
2019-03-04 17:43:12 +01:00
))
2019-09-19 17:46:52 +02:00
@ endif
2019-03-01 20:25:01 +01:00
2020-08-31 20:32:50 +02:00
< button id = "save-purchase-button"
class = "btn btn-success d-block" > {{ $__t ( 'OK' ) }} </ button >
2018-07-10 20:37:13 +02:00
</ form >
</ div >
2018-11-17 12:57:35 +01:00
< div class = "col-xs-12 col-md-6 col-xl-4 hide-when-embedded" >
2018-07-10 20:37:13 +02:00
@ include ( 'components.productcard' )
</ div >
2017-04-19 21:09:28 +02:00
</ div >
2018-04-11 19:49:35 +02:00
@ stop