2018-04-11 19:49:35 +02:00
@ extends ( 'layout.default' )
2018-04-12 21:13:38 +02:00
@ if ( $mode == 'edit' )
2020-08-31 20:32:50 +02:00
@ section ( 'title' , $__t ( 'Edit battery' ))
2018-04-12 21:13:38 +02:00
@ else
2020-08-31 20:32:50 +02:00
@ section ( 'title' , $__t ( 'Create battery' ))
2018-04-12 21:13:38 +02:00
@ endif
@ section ( 'viewJsName' , 'batteryform' )
2018-04-11 19:49:35 +02:00
@ section ( 'content' )
2020-04-19 08:51:02 -04:00
< div class = " row " >
< div class = " col " >
< h2 class = " title " >@ yield ( 'title' ) </ h2 >
</ div >
</ div >
2020-10-31 18:37:10 +01:00
2020-11-08 15:09:10 +01:00
< hr class = " my-2 " >
2020-10-31 18:37:10 +01:00
2018-07-10 20:37:13 +02:00
< div class = " row " >
2021-06-24 22:46:47 +02:00
< div class = " col-lg-6 col-12 " >
2017-11-05 12:41:00 +01:00
2020-08-31 20:32:50 +02:00
< script >
Grocy . EditMode = '{{ $mode }}' ;
</ script >
2017-11-05 12:41:00 +01:00
2018-07-10 20:37:13 +02:00
@ if ( $mode == 'edit' )
2020-08-31 20:32:50 +02:00
< script >
Grocy . EditObjectId = {{ $battery -> id }}
</ script >
2018-07-10 20:37:13 +02:00
@ endif
2017-11-05 12:41:00 +01:00
2020-08-31 20:32:50 +02:00
< form id = " battery-form "
novalidate >
2017-11-05 12:41:00 +01:00
2018-07-10 20:37:13 +02:00
< div class = " form-group " >
2019-05-01 20:19:18 +02:00
< label for = " name " > {{ $__t ( 'Name' ) }} </ label >
2020-08-31 20:32:50 +02:00
< input type = " text "
class = " form-control "
required
id = " name "
name = " name "
value = " @if( $mode == 'edit') { { $battery->name }}@endif " >
2019-05-01 20:19:18 +02:00
< div class = " invalid-feedback " > {{ $__t ( 'A name is required' ) }} </ div >
2018-07-10 20:37:13 +02:00
</ div >
2017-11-05 12:41:00 +01:00
2020-12-20 10:19:44 +01:00
< div class = " form-group " >
< div class = " custom-control custom-checkbox " >
< input @ if ( $mode == 'create'
)
checked
@ elseif ( $mode == 'edit'
&&
$battery -> active == 1 ) checked @ endif class = " form-check-input custom-control-input " type = " checkbox " id = " active " name = " active " value = " 1 " >
< label class = " form-check-label custom-control-label "
for = " active " > {{ $__t ( 'Active' ) }} </ label >
</ div >
</ div >
2018-07-10 20:37:13 +02:00
< div class = " form-group " >
2019-05-01 20:19:18 +02:00
< label for = " description " > {{ $__t ( 'Description' ) }} </ label >
2020-08-31 20:32:50 +02:00
< input type = " text "
class = " form-control "
id = " description "
name = " description "
value = " @if( $mode == 'edit') { { $battery->description }}@endif " >
2018-07-10 20:37:13 +02:00
</ div >
2017-11-05 12:41:00 +01:00
2018-07-10 20:37:13 +02:00
< div class = " form-group " >
2019-05-01 20:19:18 +02:00
< label for = " name " > {{ $__t ( 'Used in' ) }} </ label >
2020-08-31 20:32:50 +02:00
< input type = " text "
class = " form-control "
id = " used_in "
name = " used_in "
value = " @if( $mode == 'edit') { { $battery->used_in }}@endif " >
2018-07-10 20:37:13 +02:00
</ div >
2017-11-05 12:41:00 +01:00
2018-09-08 12:04:31 +02:00
@ php if ( $mode == 'edit' ) { $value = $battery -> charge_interval_days ; } else { $value = 0 ; } @ endphp
@ include ( 'components.numberpicker' , array (
2020-08-31 20:32:50 +02:00
'id' => 'charge_interval_days' ,
'label' => 'Charge cycle interval (days)' ,
'value' => $value ,
'min' => '0' ,
2020-11-16 19:10:29 +01:00
'hint' => $__t ( '0 means suggestions for the next charge cycle are disabled' )
2018-09-08 12:04:31 +02:00
))
2018-07-26 17:28:30 +02:00
2019-04-22 22:16:35 +02:00
@ include ( 'components.userfieldsform' , array (
2020-08-31 20:32:50 +02:00
'userfields' => $userfields ,
'entity' => 'batteries'
2019-04-22 22:16:35 +02:00
))
2020-08-31 20:32:50 +02:00
< button id = " save-battery-button "
class = " btn btn-success " > {{ $__t ( 'Save' ) }} </ button >
2017-11-05 12:41:00 +01:00
2018-07-10 20:37:13 +02:00
</ form >
</ div >
2017-11-05 12:41:00 +01:00
</ div >
2021-07-13 19:29:23 +02:00
2021-09-27 17:20:52 +02:00
@ if ( $mode == 'edit' )
2021-07-13 19:29:23 +02:00
< div class = " row mt-2 border-top " >
< div class = " col clearfix mt-2 " >
< div class = " title-related-links " >
< h4 >
< span class = " ls-n1 " > {{ $__t ( 'grocycode' ) }} </ span >
< i class = " fas fa-question-circle text-muted "
data - toggle = " tooltip "
data - trigger = " hover click "
title = " { { $__t ('grocycode is a unique referer to this %s in your grocy instance - print it onto a label and scan it like any other barcode', $__t ('Battery')) }} " ></ i >
</ h4 >
< p >
@ if ( $mode == 'edit' )
< img src = " { { $U ('/battery/' . $battery->id . '/grocycode?size=60') }} "
class = " float-lg-left " >
@ endif
</ p >
< p >
< a class = " btn btn-outline-primary btn-sm "
href = " { { $U ('/battery/' . $battery->id . '/grocycode?download=true') }} " > {{ $__t ( 'Download' ) }} </ a >
@ if ( GROCY_FEATURE_FLAG_LABEL_PRINTER )
< a class = " btn btn-outline-primary btn-sm battery-grocycode-label-print "
data - battery - id = " { { $battery->id }} "
href = " # " >
{{ $__t ( 'Print on label printer' ) }}
</ a >
@ endif
</ p >
</ div >
</ div >
</ div >
2021-09-27 17:20:52 +02:00
@ endif
2018-04-11 19:49:35 +02:00
@ stop