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 chore' ))
2018-04-12 21:13:38 +02:00
@ else
2020-08-31 20:32:50 +02:00
@ section ( 'title' , $__t ( 'Create chore' ))
2018-04-12 21:13:38 +02:00
@ endif
2018-09-22 13:26:58 +02:00
@ section ( 'viewJsName' , 'choreform' )
2018-04-12 21:13:38 +02:00
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 " >
2020-08-31 20:32:50 +02:00
< script >
Grocy . EditMode = '{{ $mode }}' ;
</ script >
2018-07-10 20:37:13 +02:00
@ if ( $mode == 'edit' )
2020-08-31 20:32:50 +02:00
< script >
Grocy . EditObjectId = {{ $chore -> id }};
</ script >
2018-07-10 20:37:13 +02:00
@ endif
2020-08-31 20:32:50 +02:00
< form id = " chore-form "
2021-09-15 14:59:11 +02:00
class = " has-sticky-form-footer "
2020-08-31 20:32:50 +02:00
novalidate >
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') { { $chore->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 >
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'
&&
$chore -> 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
< textarea class = " form-control "
rows = " 2 "
id = " description "
name = " description " >@ if ( $mode == 'edit' ){{ $chore -> description }} @ endif </ textarea >
2018-07-10 20:37:13 +02:00
</ div >
< div class = " form-group " >
2020-11-08 19:00:12 +01:00
< label for = " period_type " > {{ $__t ( 'Period type' ) }} & nbsp ; < i id = " chore-period-type-info "
2020-11-15 15:23:47 +01:00
class = " fas fa-question-circle text-muted "
2020-11-08 19:00:12 +01:00
data - toggle = " tooltip "
2021-06-27 19:34:28 +02:00
data - trigger = " hover click "
2020-11-08 19:00:12 +01:00
title = " " ></ i ></ label >
2020-08-31 20:32:50 +02:00
< select required
2020-11-16 19:10:29 +01:00
class = " custom-control custom-select input-group-chore-period-type "
2020-08-31 20:32:50 +02:00
id = " period_type "
name = " period_type " >
2018-07-10 20:37:13 +02:00
@ foreach ( $periodTypes as $periodType )
2020-08-31 20:32:50 +02:00
< option @ if ( $mode == 'edit'
&&
$periodType == $chore -> period_type ) selected = " selected " @ endif value = " { { $periodType }} " > {{ $__t ( $periodType ) }} </ option >
2018-07-10 20:37:13 +02:00
@ endforeach
</ select >
2019-05-01 20:19:18 +02:00
< div class = " invalid-feedback " > {{ $__t ( 'A period type is required' ) }} </ div >
2018-07-10 20:37:13 +02:00
</ div >
2018-09-22 13:26:58 +02:00
@ php if ( $mode == 'edit' ) { $value = $chore -> period_days ; } else { $value = 0 ; } @ endphp
2018-09-08 12:04:31 +02:00
@ include ( 'components.numberpicker' , array (
2020-08-31 20:32:50 +02:00
'id' => 'period_days' ,
'label' => 'Period days' ,
'value' => $value ,
'min' => '0' ,
'additionalCssClasses' => 'input-group-chore-period-type' ,
'additionalGroupCssClasses' => 'period-type-input period-type-dynamic-regular period-type-monthly'
2018-09-08 12:04:31 +02:00
))
2018-07-10 20:37:13 +02:00
2019-04-22 14:01:31 +02:00
< div class = " form-group period-type-input period-type-weekly " >
2020-11-08 19:00:12 +01:00
< div class = " custom-control custom-checkbox custom-control-inline " >
< input class = " form-check-input custom-control-input input-group-chore-period-type "
2020-08-31 20:32:50 +02:00
type = " checkbox "
id = " monday "
value = " monday " >
2020-11-08 19:00:12 +01:00
< label class = " form-check-label custom-control-label "
2020-08-31 20:32:50 +02:00
for = " monday " > {{ $__t ( 'Monday' ) }} </ label >
2019-04-22 14:01:31 +02:00
</ div >
2020-11-08 19:00:12 +01:00
< div class = " custom-control custom-checkbox custom-control-inline " >
< input class = " form-check-input custom-control-input input-group-chore-period-type "
2020-08-31 20:32:50 +02:00
type = " checkbox "
id = " tuesday "
value = " tuesday " >
2020-11-08 19:00:12 +01:00
< label class = " form-check-label custom-control-label "
2020-08-31 20:32:50 +02:00
for = " tuesday " > {{ $__t ( 'Tuesday' ) }} </ label >
2019-04-22 14:01:31 +02:00
</ div >
2020-11-08 19:00:12 +01:00
< div class = " custom-control custom-checkbox custom-control-inline " >
< input class = " form-check-input custom-control-input input-group-chore-period-type "
2020-08-31 20:32:50 +02:00
type = " checkbox "
id = " wednesday "
value = " wednesday " >
2020-11-08 19:00:12 +01:00
< label class = " form-check-label custom-control-label "
2020-08-31 20:32:50 +02:00
for = " wednesday " > {{ $__t ( 'Wednesday' ) }} </ label >
2019-04-22 14:01:31 +02:00
</ div >
2020-11-08 19:00:12 +01:00
< div class = " custom-control custom-checkbox custom-control-inline " >
< input class = " form-check-input custom-control-input input-group-chore-period-type "
2020-08-31 20:32:50 +02:00
type = " checkbox "
id = " thursday "
value = " thursday " >
2020-11-08 19:00:12 +01:00
< label class = " form-check-label custom-control-label "
2020-08-31 20:32:50 +02:00
for = " thursday " > {{ $__t ( 'Thursday' ) }} </ label >
2019-04-22 14:01:31 +02:00
</ div >
2020-11-08 19:00:12 +01:00
< div class = " custom-control custom-checkbox custom-control-inline " >
< input class = " form-check-input custom-control-input input-group-chore-period-type "
2020-08-31 20:32:50 +02:00
type = " checkbox "
id = " friday "
value = " friday " >
2020-11-08 19:00:12 +01:00
< label class = " form-check-label custom-control-label "
2020-08-31 20:32:50 +02:00
for = " friday " > {{ $__t ( 'Friday' ) }} </ label >
2019-04-22 14:01:31 +02:00
</ div >
2020-11-08 19:00:12 +01:00
< div class = " custom-control custom-checkbox custom-control-inline " >
< input class = " form-check-input custom-control-input input-group-chore-period-type "
2020-08-31 20:32:50 +02:00
type = " checkbox "
id = " saturday "
value = " saturday " >
2020-11-08 19:00:12 +01:00
< label class = " form-check-label custom-control-label "
2021-01-01 14:31:49 +01:00
for = " saturday " > {{ $__t ( 'Saturday' ) }} </ label >
2019-04-22 14:01:31 +02:00
</ div >
2020-11-08 19:00:12 +01:00
< div class = " custom-control custom-checkbox custom-control-inline " >
< input class = " form-check-input custom-control-input input-group-chore-period-type "
2020-08-31 20:32:50 +02:00
type = " checkbox "
id = " sunday "
value = " sunday " >
2020-11-08 19:00:12 +01:00
< label class = " form-check-label custom-control-label "
2021-01-01 14:31:49 +01:00
for = " sunday " > {{ $__t ( 'Sunday' ) }} </ label >
2019-04-22 14:01:31 +02:00
</ div >
</ div >
2020-08-31 20:32:50 +02:00
< input type = " hidden "
id = " period_config "
name = " period_config "
value = " @if( $mode == 'edit') { { $chore->period_config }}@endif " >
2019-04-22 14:01:31 +02:00
2019-10-04 11:14:11 +02:00
@ php if ( $mode == 'edit' ) { $value = $chore -> period_interval ; } else { $value = 1 ; } @ endphp
@ include ( 'components.numberpicker' , array (
2020-08-31 20:32:50 +02:00
'id' => 'period_interval' ,
'label' => 'Period interval' ,
'value' => $value ,
'min' => '1' ,
'additionalCssClasses' => 'input-group-chore-period-type' ,
'additionalGroupCssClasses' => 'period-type-input period-type-daily period-type-weekly period-type-monthly period-type-yearly' ,
'hintId' => 'chore-period-interval-info'
2019-10-04 11:14:11 +02:00
))
2019-09-26 17:20:25 +02:00
@ if ( GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS )
2019-09-17 13:13:26 +02:00
< div class = " form-group " >
2020-11-08 19:00:12 +01:00
< label for = " assignment_type " > {{ $__t ( 'Assignment type' ) }} < i id = " chore-assignment-type-info "
2020-11-15 15:23:47 +01:00
class = " fas fa-question-circle text-muted "
2020-11-08 19:00:12 +01:00
data - toggle = " tooltip "
2021-06-27 19:34:28 +02:00
data - trigger = " hover click "
2020-11-08 19:00:12 +01:00
title = " " ></ i ></ label >
2020-08-31 20:32:50 +02:00
< select required
2020-11-16 19:10:29 +01:00
class = " custom-control custom-select input-group-chore-assignment-type "
2020-08-31 20:32:50 +02:00
id = " assignment_type "
name = " assignment_type " >
2019-09-17 13:13:26 +02:00
@ foreach ( $assignmentTypes as $assignmentType )
2020-08-31 20:32:50 +02:00
< option @ if ( $mode == 'edit'
&&
$assignmentType == $chore -> assignment_type ) selected = " selected " @ endif value = " { { $assignmentType }} " > {{ $__t ( $assignmentType ) }} </ option >
2019-09-17 13:13:26 +02:00
@ endforeach
</ select >
< div class = " invalid-feedback " > {{ $__t ( 'An assignment type is required' ) }} </ div >
</ div >
< div class = " form-group " >
< label for = " assignment_config " > {{ $__t ( 'Assign to' ) }} </ label >
2020-08-31 20:32:50 +02:00
< select required
multiple
2020-11-17 19:11:02 +01:00
class = " form-control input-group-chore-assignment-type selectpicker "
2020-08-31 20:32:50 +02:00
id = " assignment_config "
name = " assignment_config "
data - actions - Box = " true "
data - live - search = " true " >
2019-09-17 13:13:26 +02:00
@ foreach ( $users as $user )
2020-08-31 20:32:50 +02:00
< option @ if ( $mode == 'edit'
&&
in_array ( $user -> id , explode ( ',' , $chore -> assignment_config ))) selected = " selected " @ endif value = " { { $user->id }} " > {{ $user -> display_name }} </ option >
2019-09-17 13:13:26 +02:00
@ endforeach
</ select >
< div class = " invalid-feedback " > {{ $__t ( 'This assignment type requires that at least one is assigned' ) }} </ div >
</ div >
2019-09-26 17:20:25 +02:00
@ else
2020-08-31 20:32:50 +02:00
< input type = " hidden "
id = " assignment_type "
name = " assignment_type "
value = " { { \ Grocy \ Services \ ChoresService::CHORE_ASSIGNMENT_TYPE_NO_ASSIGNMENT }} " >
< input type = " hidden "
id = " assignment_config "
name = " assignment_config "
value = " " >
2019-09-26 17:20:25 +02:00
@ endif
2019-09-17 13:13:26 +02:00
2019-05-04 16:13:05 +02:00
< div class = " form-group " >
2020-11-08 19:00:12 +01:00
< div class = " custom-control custom-checkbox " >
2020-08-31 20:32:50 +02:00
< input @ if ( $mode == 'edit'
&&
2020-11-08 19:00:12 +01:00
$chore -> track_date_only == 1 ) checked @ endif class = " form-check-input custom-control-input " type = " checkbox " id = " track_date_only " name = " track_date_only " value = " 1 " >
< label class = " form-check-label custom-control-label "
2020-08-31 20:32:50 +02:00
for = " track_date_only " > {{ $__t ( 'Track date only' ) }}
2020-11-15 15:23:47 +01:00
& nbsp ; < i class = " fas fa-question-circle text-muted "
2020-11-08 19:00:12 +01:00
data - toggle = " tooltip "
2021-06-27 19:34:28 +02:00
data - trigger = " hover click "
2020-11-08 19:00:12 +01:00
title = " { { $__t ('When enabled only the day of an execution is tracked, not the time') }} " ></ i >
2019-05-04 16:13:05 +02:00
</ label >
</ div >
</ div >
2019-08-10 12:44:09 +02:00
< div class = " form-group " >
2020-11-08 19:00:12 +01:00
< div class = " custom-control custom-checkbox " >
2020-08-31 20:32:50 +02:00
< input @ if ( $mode == 'edit'
&&
2020-11-08 19:00:12 +01:00
$chore -> rollover == 1 ) checked @ endif class = " form-check-input custom-control-input " type = " checkbox " id = " rollover " name = " rollover " value = " 1 " >
< label class = " form-check-label custom-control-label "
2020-08-31 20:32:50 +02:00
for = " rollover " > {{ $__t ( 'Due date rollover' ) }}
2020-11-15 15:23:47 +01:00
& nbsp ; < i class = " fas fa-question-circle text-muted "
2020-11-08 19:00:12 +01:00
data - toggle = " tooltip "
2021-06-27 19:34:28 +02:00
data - trigger = " hover click "
2020-11-08 19:00:12 +01:00
title = " { { $__t ('When enabled the chore can never be overdue, the due date will shift forward each day when due') }} " ></ i >
2019-08-10 12:44:09 +02:00
</ label >
</ div >
</ div >
2019-09-18 10:02:52 +02:00
@ if ( GROCY_FEATURE_FLAG_STOCK )
< div class = " form-group mt-4 mb-1 " >
2020-11-08 19:00:12 +01:00
< div class = " custom-control custom-checkbox " >
2020-08-31 20:32:50 +02:00
< input @ if ( $mode == 'edit'
&&
2020-11-08 19:00:12 +01:00
$chore -> consume_product_on_execution == 1 ) checked @ endif class = " form-check-input custom-control-input " type = " checkbox " id = " consume_product_on_execution " name = " consume_product_on_execution " value = " 1 " >
< label class = " form-check-label custom-control-label "
2020-08-31 20:32:50 +02:00
for = " consume_product_on_execution " > {{ $__t ( 'Consume product on chore execution' ) }} </ label >
2019-09-18 10:02:52 +02:00
</ div >
</ div >
@ php $prefillById = '' ; if ( $mode == 'edit' && ! empty ( $chore -> product_id )) { $prefillById = $chore -> product_id ; } @ endphp
@ include ( 'components.productpicker' , array (
2020-08-31 20:32:50 +02:00
'products' => $products ,
'nextInputSelector' => '#product_amount' ,
'isRequired' => false ,
'disallowAllProductWorkflows' => true ,
'prefillById' => $prefillById
2019-09-18 10:02:52 +02:00
))
@ php if ( $mode == 'edit' ) { $value = $chore -> product_amount ; } else { $value = '' ; } @ endphp
@ include ( 'components.numberpicker' , array (
2020-08-31 20:32:50 +02:00
'id' => 'product_amount' ,
'label' => 'Amount' ,
2020-11-13 19:03:25 +01:00
'contextInfoId' => 'amount_qu_unit' ,
2020-12-23 19:56:37 +01:00
'min' => $DEFAULT_MIN_AMOUNT ,
2020-10-20 13:08:54 -05:00
'decimals' => $userSettings [ 'stock_decimal_places_amounts' ],
2020-08-31 20:32:50 +02:00
'isRequired' => false ,
2020-11-15 14:15:09 +01:00
'value' => $value ,
'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount'
2019-09-18 10:02:52 +02:00
))
@ endif
2019-04-22 22:16:35 +02:00
@ include ( 'components.userfieldsform' , array (
2020-08-31 20:32:50 +02:00
'userfields' => $userfields ,
'entity' => 'chores'
2019-04-22 22:16:35 +02:00
))
2021-09-15 14:59:11 +02:00
< div class = " sticky-form-footer pt-1 " >
< button id = " save-chore-button "
class = " btn btn-success " > {{ $__t ( 'Save' ) }} </ button >
</ div >
2018-07-10 20:37:13 +02:00
</ form >
</ div >
2021-07-13 19:29:23 +02:00
< div class = " col-lg-6 col-12 @if( $mode == 'create') d-none @endif " >
< div class = " row " >
< div class = " col clearfix " >
2021-09-15 14:59:11 +02:00
< div class = " title-related-links pb-4 " >
2021-07-13 19:29:23 +02:00
< 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 ('Chore')) }} " ></ i >
</ h4 >
< p >
@ if ( $mode == 'edit' )
< img src = " { { $U ('/chore/' . $chore->id . '/grocycode?size=60') }} "
class = " float-lg-left " >
@ endif
</ p >
< p >
< a class = " btn btn-outline-primary btn-sm "
href = " { { $U ('/chore/' . $chore->id . '/grocycode?download=true') }} " > {{ $__t ( 'Download' ) }} </ a >
@ if ( GROCY_FEATURE_FLAG_LABEL_PRINTER )
< a class = " btn btn-outline-primary btn-sm chore-grocycode-label-print "
data - chore - id = " { { $chore->id }} "
href = " # " >
{{ $__t ( 'Print on label printer' ) }}
</ a >
@ endif
</ p >
</ div >
</ div >
</ div >
</ div >
2017-07-25 20:03:31 +02:00
</ div >
2018-04-11 19:49:35 +02:00
@ stop