Applied .blade.php formatting rules

This commit is contained in:
Bernd Bestel
2020-08-31 20:32:50 +02:00
parent ea9ba0b2be
commit 33325d5560
90 changed files with 4000 additions and 2091 deletions

View File

@@ -10,19 +10,27 @@
<hr> <hr>
<ul class="nav nav-tabs justify-content-center mt-3"> <ul class="nav nav-tabs justify-content-center mt-3">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active" id="system-info-tab" data-toggle="tab" href="#system-info">{{ $__t('System info') }}</a> <a class="nav-link active"
id="system-info-tab"
data-toggle="tab"
href="#system-info">{{ $__t('System info') }}</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="changelog-tab" data-toggle="tab" href="#changelog">{{ $__t('Changelog') }}</a> <a class="nav-link"
id="changelog-tab"
data-toggle="tab"
href="#changelog">{{ $__t('Changelog') }}</a>
</li> </li>
</ul> </ul>
<div class="tab-content mt-3"> <div class="tab-content mt-3">
<div class="tab-pane show active" id="system-info"> <div class="tab-pane show active"
id="system-info">
<p> <p>
Version <code>{{ $version }}</code><br> Version <code>{{ $version }}</code><br>
{{ $__t('Released on') }} <code>{{ $releaseDate }}</code> <time class="timeago timeago-contextual" datetime="{{ $releaseDate }}"></time> {{ $__t('Released on') }} <code>{{ $releaseDate }}</code> <time class="timeago timeago-contextual"
datetime="{{ $releaseDate }}"></time>
</p> </p>
<p> <p>
@@ -32,19 +40,25 @@
<p> <p>
{{ $__t('Do you find grocy useful?') }}<br> {{ $__t('Do you find grocy useful?') }}<br>
<a class="btn btn-sm btn-primary text-white mt-1" href="https://grocy.info/#say-thanks" target = "_blank">{{ $__t('Say thanks') }} <i class="fas fa-heart"></i></a> <a class="btn btn-sm btn-primary text-white mt-1"
href="https://grocy.info/#say-thanks"
target="_blank">{{ $__t('Say thanks') }} <i class="fas fa-heart"></i></a>
</p> </p>
</div> </div>
<div class="tab-pane show" id="changelog"> <div class="tab-pane show"
id="changelog">
@php $Parsedown = new Parsedown(); @endphp @php $Parsedown = new Parsedown(); @endphp
@foreach($changelog['changelog_items'] as $changelogItem) @foreach($changelog['changelog_items'] as $changelogItem)
<div class="card my-2"> <div class="card my-2">
<div class="card-header"> <div class="card-header">
<a class="discrete-link" data-toggle="collapse-next" href="#"> <a class="discrete-link"
data-toggle="collapse-next"
href="#">
Version <span class="font-weight-bold">{{ $changelogItem['version'] }}</span><br> Version <span class="font-weight-bold">{{ $changelogItem['version'] }}</span><br>
{{ $__t('Released on') }} <span class="font-weight-bold">{{ $changelogItem['release_date'] }}</span> {{ $__t('Released on') }} <span class="font-weight-bold">{{ $changelogItem['release_date'] }}</span>
<time class="timeago timeago-contextual" datetime="{{ $changelogItem['release_date'] }}"></time> <time class="timeago timeago-contextual"
datetime="{{ $changelogItem['release_date'] }}"></time>
</a> </a>
</div> </div>
<div class="collapse @if($changelogItem['release_number'] >= $changelog['newest_release_number'] - 4) show @endif"> <div class="collapse @if($changelogItem['release_number'] >= $changelog['newest_release_number'] - 4) show @endif">
@@ -60,10 +74,14 @@
<p class="small text-muted"> <p class="small text-muted">
grocy is a project by grocy is a project by
<a href="https://berrnd.de" class="text-dark" target="_blank">Bernd Bestel</a><br> <a href="https://berrnd.de"
class="text-dark"
target="_blank">Bernd Bestel</a><br>
Created with passion since 2017<br> Created with passion since 2017<br>
Life runs on code<br> Life runs on code<br>
<a href="https://github.com/grocy/grocy" class="text-dark" target="_blank"> <a href="https://github.com/grocy/grocy"
class="text-dark"
target="_blank">
<i class="fab fa-github"></i> <i class="fab fa-github"></i>
</a> </a>
</p> </p>

View File

@@ -5,7 +5,8 @@
@section('viewJsName', 'barcodescannertesting') @section('viewJsName', 'barcodescannertesting')
@push('pageScripts') @push('pageScripts')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
@endpush @endpush
@section('content') @section('content')
@@ -18,27 +19,45 @@
<div class="row"> <div class="row">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<form id="barcodescannertesting-form" novalidate> <form id="barcodescannertesting-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="expected_barcode">{{ $__t('Expected barcode') }}</label> <label for="expected_barcode">{{ $__t('Expected barcode') }}</label>
<input type="text" class="form-control" required id="expected_barcode" name="expected_barcode" value=""> <input type="text"
class="form-control"
required
id="expected_barcode"
name="expected_barcode"
value="">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="scanned_barcode">{{ $__t('Scan field') }}</label> <label for="scanned_barcode">{{ $__t('Scan field') }}</label>
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control barcodescanner-input" id="scanned_barcode" name="scanned_barcode" value="" disabled data-target="#scanned_barcode"> <input type="text"
class="form-control barcodescanner-input"
id="scanned_barcode"
name="scanned_barcode"
value=""
disabled
data-target="#scanned_barcode">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="scanned_codes">{{ $__t('Scanned barcodes') }}</label> <label for="scanned_codes">{{ $__t('Scanned barcodes') }}</label>
<div class="float-right font-weight-bold"> <div class="float-right font-weight-bold">
<span class="text-success">{{ $__t('Hit') }}: <span id="hit-count" class="locale-number locale-number-generic">0</span></span> // <span class="text-success">{{ $__t('Hit') }}: <span id="hit-count"
<span class="text-danger">{{ $__t('Miss') }}: <span id="miss-count" class="locale-number locale-number-generic">0</span></span> class="locale-number locale-number-generic">0</span></span> //
<span class="text-danger">{{ $__t('Miss') }}: <span id="miss-count"
class="locale-number locale-number-generic">0</span></span>
</div> </div>
<select class="form-control" id="scanned_codes" name="scanned_codes" multiple size="30"></select> <select class="form-control"
id="scanned_codes"
name="scanned_codes"
multiple
size="30"></select>
</div> </div>
</form> </form>

View File

@@ -10,7 +10,8 @@
<div class="title-related-links"> <div class="title-related-links">
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<div class="related-links"> <div class="related-links">
<a class="btn btn-outline-secondary" href="{{ $U('/userfields?entity=batteries') }}"> <a class="btn btn-outline-secondary"
href="{{ $U('/userfields?entity=batteries') }}">
{{ $__t('Configure userfields') }} {{ $__t('Configure userfields') }}
</a> </a>
</div> </div>
@@ -20,7 +21,8 @@
<hr> <hr>
<div class="row mt-3"> <div class="row mt-3">
<div class="col-xs-12 col-md-2 col-xl-1"> <div class="col-xs-12 col-md-2 col-xl-1">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3 permission-MASTER_DATA_EDIT" href="{{ $U('/battery/new') }}"> <a class="btn btn-primary btn-sm responsive-button w-100 mb-3 permission-MASTER_DATA_EDIT"
href="{{ $U('/battery/new') }}">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
@@ -29,16 +31,20 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="batteries-table" class="table table-sm table-striped dt-responsive"> <table id="batteries-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -48,7 +54,7 @@
<th>{{ $__t('Charge cycle interval (days)') }}</th> <th>{{ $__t('Charge cycle interval (days)') }}</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
@@ -57,10 +63,14 @@
@foreach($batteries as $battery) @foreach($batteries as $battery)
<tr> <tr>
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-info btn-sm permission-MASTER_DATA_EDIT" href="{{ $U('/battery/') }}{{ $battery->id }}"> <a class="btn btn-info btn-sm permission-MASTER_DATA_EDIT"
href="{{ $U('/battery/') }}{{ $battery->id }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-danger btn-sm battery-delete-button permission-MASTER_DATA_EDIT" href="#" data-battery-id="{{ $battery->id }}" data-battery-name="{{ $battery->name }}"> <a class="btn btn-danger btn-sm battery-delete-button permission-MASTER_DATA_EDIT"
href="#"
data-battery-id="{{ $battery->id }}"
data-battery-name="{{ $battery->name }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
</td> </td>
@@ -78,8 +88,8 @@
</td> </td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $battery->id) 'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $battery->id)
)) ))
</tr> </tr>

View File

@@ -16,21 +16,25 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-filter"></i></span> <span class="input-group-text"><i class="fas fa-filter"></i></span>
</div> </div>
<select class="form-control" id="battery-filter"> <select class="form-control"
id="battery-filter">
<option value="all">{{ $__t('All') }}</option> <option value="all">{{ $__t('All') }}</option>
@foreach($batteries as $battery) @foreach($batteries as $battery)
<option value="{{ $battery->id }}">{{ $battery->name }}</option> <option value="{{ $battery->id }}">{{ $battery->name }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
</div> </div>
@@ -38,7 +42,8 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="batteries-journal-table" class="table table-sm table-striped dt-responsive"> <table id="batteries-journal-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -48,9 +53,15 @@
</thead> </thead>
<tbody class="d-none"> <tbody class="d-none">
@foreach($chargeCycles as $chargeCycleEntry) @foreach($chargeCycles as $chargeCycleEntry)
<tr id="charge-cycle-{{ $chargeCycleEntry->id }}-row" class="@if($chargeCycleEntry->undone == 1) text-muted @endif"> <tr id="charge-cycle-{{ $chargeCycleEntry->id }}-row"
class="@if($chargeCycleEntry->undone == 1) text-muted @endif">
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-secondary btn-sm undo-battery-execution-button @if($chargeCycleEntry->undone == 1) disabled @endif permission-BATTERIES_UNDO_CHARGE_CYCLE" href="#" data-charge-cycle-id="{{ $chargeCycleEntry->id }}" data-toggle="tooltip" data-placement="left" title="{{ $__t('Undo charge cycle') }}"> <a class="btn btn-secondary btn-sm undo-battery-execution-button @if($chargeCycleEntry->undone == 1) disabled @endif permission-BATTERIES_UNDO_CHARGE_CYCLE"
href="#"
data-charge-cycle-id="{{ $chargeCycleEntry->id }}"
data-toggle="tooltip"
data-placement="left"
title="{{ $__t('Undo charge cycle') }}">
<i class="fas fa-undo"></i> <i class="fas fa-undo"></i>
</a> </a>
</td> </td>
@@ -59,12 +70,14 @@
@if($chargeCycleEntry->undone == 1) @if($chargeCycleEntry->undone == 1)
<br> <br>
{{ $__t('Undone on') . ' ' . $chargeCycleEntry->undone_timestamp }} {{ $__t('Undone on') . ' ' . $chargeCycleEntry->undone_timestamp }}
<time class="timeago timeago-contextual" datetime="{{ $chargeCycleEntry->undone_timestamp }}"></time> <time class="timeago timeago-contextual"
datetime="{{ $chargeCycleEntry->undone_timestamp }}"></time>
@endif @endif
</td> </td>
<td> <td>
{{ $chargeCycleEntry->tracked_time }} {{ $chargeCycleEntry->tracked_time }}
<time class="timeago timeago-contextual" datetime="{{ $chargeCycleEntry->tracked_time }}"></time> <time class="timeago timeago-contextual"
datetime="{{ $chargeCycleEntry->tracked_time }}"></time>
</td> </td>
</tr> </tr>
@endforeach @endforeach

View File

@@ -5,7 +5,8 @@
@section('viewJsName', 'batteriesoverview') @section('viewJsName', 'batteriesoverview')
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
@endpush @endpush
@section('content') @section('content')
@@ -14,14 +15,20 @@
<div class="title-related-links"> <div class="title-related-links">
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<div class="related-links"> <div class="related-links">
<a class="btn btn-outline-dark responsive-button" href="{{ $U('/batteriesjournal') }}"> <a class="btn btn-outline-dark responsive-button"
{{ $__t('Journal') }} href="{{ $U('/batteriesjournal') }}">
{{ $__t('Journal') }}
</a> </a>
</div> </div>
</div> </div>
<hr> <hr>
<p id="info-due-batteries" data-status-filter="duesoon" data-next-x-days="{{ $nextXDays }}" class="warning-message status-filter-message responsive-button mr-2"></p> <p id="info-due-batteries"
<p id="info-overdue-batteries" data-status-filter="overdue" class="error-message status-filter-message responsive-button"></p> data-status-filter="duesoon"
data-next-x-days="{{ $nextXDays }}"
class="warning-message status-filter-message responsive-button mr-2"></p>
<p id="info-overdue-batteries"
data-status-filter="overdue"
class="error-message status-filter-message responsive-button"></p>
</div> </div>
</div> </div>
@@ -29,17 +36,21 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-filter"></i></span> <span class="input-group-text"><i class="fas fa-filter"></i></span>
</div> </div>
<select class="form-control" id="status-filter"> <select class="form-control"
id="status-filter">
<option value="all">{{ $__t('All') }}</option> <option value="all">{{ $__t('All') }}</option>
<option value="duesoon">{{ $__t('Due soon') }}</option> <option value="duesoon">{{ $__t('Due soon') }}</option>
<option value="overdue">{{ $__t('Overdue') }}</option> <option value="overdue">{{ $__t('Overdue') }}</option>
@@ -50,7 +61,8 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="batteries-overview-table" class="table table-sm table-striped dt-responsive"> <table id="batteries-overview-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -60,60 +72,92 @@
<th class="d-none">Hidden status</th> <th class="d-none">Hidden status</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
</thead> </thead>
<tbody class="d-none"> <tbody class="d-none">
@foreach($current as $currentBatteryEntry) @foreach($current as $currentBatteryEntry)
<tr id="battery-{{ $currentBatteryEntry->battery_id }}-row" class="@if(FindObjectInArrayByPropertyValue($batteries, 'id', $currentBatteryEntry->battery_id)->charge_interval_days > 0 && $currentBatteryEntry->next_estimated_charge_time < date('Y-m-d H:i:s')) table-danger @elseif(FindObjectInArrayByPropertyValue($batteries, 'id', $currentBatteryEntry->battery_id)->charge_interval_days > 0 && $currentBatteryEntry->next_estimated_charge_time < date('Y-m-d H:i:s', strtotime("+$nextXDays days"))) table-warning @endif"> <tr id="battery-{{ $currentBatteryEntry->battery_id }}-row"
class="@if(FindObjectInArrayByPropertyValue($batteries, 'id', $currentBatteryEntry->battery_id)->charge_interval_days > 0 && $currentBatteryEntry->next_estimated_charge_time < date('Y-m-d H:i:s')) table-danger @elseif(FindObjectInArrayByPropertyValue($batteries, 'id', $currentBatteryEntry->battery_id)->charge_interval_days > 0 && $currentBatteryEntry->next_estimated_charge_time < date('Y-m-d H:i:s', strtotime("
+$nextXDays
days")))
table-warning
@endif">
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-success btn-sm track-charge-cycle-button permission-BATTERIES_TRACK_CHARGE_CYCLE" href="#" data-toggle="tooltip" data-placement="left" title="{{ $__t('Track charge cycle of battery %s', FindObjectInArrayByPropertyValue($batteries, 'id', $currentBatteryEntry->battery_id)->name) }}" <a class="btn btn-success btn-sm track-charge-cycle-button permission-BATTERIES_TRACK_CHARGE_CYCLE"
href="#"
data-toggle="tooltip"
data-placement="left"
title="{{ $__t('Track charge cycle of battery %s', FindObjectInArrayByPropertyValue($batteries, 'id', $currentBatteryEntry->battery_id)->name) }}"
data-battery-id="{{ $currentBatteryEntry->battery_id }}" data-battery-id="{{ $currentBatteryEntry->battery_id }}"
data-battery-name="{{ FindObjectInArrayByPropertyValue($batteries, 'id', $currentBatteryEntry->battery_id)->name }}"> data-battery-name="{{ FindObjectInArrayByPropertyValue($batteries, 'id', $currentBatteryEntry->battery_id)->name }}">
<i class="fas fa-fire"></i> <i class="fas fa-fire"></i>
</a> </a>
<div class="dropdown d-inline-block"> <div class="dropdown d-inline-block">
<button class="btn btn-sm btn-light text-secondary" type="button" data-toggle="dropdown"> <button class="btn btn-sm btn-light text-secondary"
type="button"
data-toggle="dropdown">
<i class="fas fa-ellipsis-v"></i> <i class="fas fa-ellipsis-v"></i>
</button> </button>
<div class="table-inline-menu dropdown-menu dropdown-menu-right"> <div class="table-inline-menu dropdown-menu dropdown-menu-right">
<a class="dropdown-item battery-name-cell" data-battery-id="{{ $currentBatteryEntry->battery_id }}" type="button" href="#"> <a class="dropdown-item battery-name-cell"
data-battery-id="{{ $currentBatteryEntry->battery_id }}"
type="button"
href="#">
<span class="dropdown-item-icon"><i class="fas fa-info"></i></span> <span class="dropdown-item-text">{{ $__t('Show battery details') }}</span> <span class="dropdown-item-icon"><i class="fas fa-info"></i></span> <span class="dropdown-item-text">{{ $__t('Show battery details') }}</span>
</a> </a>
<a class="dropdown-item" type="button" href="{{ $U('/batteriesjournal?battery=') }}{{ $currentBatteryEntry->battery_id }}"> <a class="dropdown-item"
type="button"
href="{{ $U('/batteriesjournal?battery=') }}{{ $currentBatteryEntry->battery_id }}">
<span class="dropdown-item-icon"><i class="fas fa-file-alt"></i></span> <span class="dropdown-item-text">{{ $__t('Journal for this battery') }}</span> <span class="dropdown-item-icon"><i class="fas fa-file-alt"></i></span> <span class="dropdown-item-text">{{ $__t('Journal for this battery') }}</span>
</a> </a>
<a class="dropdown-item permission-MASTER_DATA_EDIT" type="button" href="{{ $U('/battery/') }}{{ $currentBatteryEntry->battery_id }}"> <a class="dropdown-item permission-MASTER_DATA_EDIT"
type="button"
href="{{ $U('/battery/') }}{{ $currentBatteryEntry->battery_id }}">
<span class="dropdown-item-icon"><i class="fas fa-edit"></i></span> <span class="dropdown-item-text">{{ $__t('Edit battery') }}</span> <span class="dropdown-item-icon"><i class="fas fa-edit"></i></span> <span class="dropdown-item-text">{{ $__t('Edit battery') }}</span>
</a> </a>
</div> </div>
</div> </div>
</td> </td>
<td class="battery-name-cell cursor-link" data-battery-id="{{ $currentBatteryEntry->battery_id }}"> <td class="battery-name-cell cursor-link"
data-battery-id="{{ $currentBatteryEntry->battery_id }}">
{{ FindObjectInArrayByPropertyValue($batteries, 'id', $currentBatteryEntry->battery_id)->name }} {{ FindObjectInArrayByPropertyValue($batteries, 'id', $currentBatteryEntry->battery_id)->name }}
</td> </td>
<td> <td>
<span id="battery-{{ $currentBatteryEntry->battery_id }}-last-tracked-time">{{ $currentBatteryEntry->last_tracked_time }}</span> <span id="battery-{{ $currentBatteryEntry->battery_id }}-last-tracked-time">{{ $currentBatteryEntry->last_tracked_time }}</span>
<time id="battery-{{ $currentBatteryEntry->battery_id }}-last-tracked-time-timeago" class="timeago timeago-contextual" datetime="{{ $currentBatteryEntry->last_tracked_time }}"></time> <time id="battery-{{ $currentBatteryEntry->battery_id }}-last-tracked-time-timeago"
class="timeago timeago-contextual"
datetime="{{ $currentBatteryEntry->last_tracked_time }}"></time>
</td> </td>
<td> <td>
@if(FindObjectInArrayByPropertyValue($batteries, 'id', $currentBatteryEntry->battery_id)->charge_interval_days > 0) @if(FindObjectInArrayByPropertyValue($batteries, 'id', $currentBatteryEntry->battery_id)->charge_interval_days > 0)
<span id="battery-{{ $currentBatteryEntry->battery_id }}-next-charge-time">{{ $currentBatteryEntry->next_estimated_charge_time }}</span> <span id="battery-{{ $currentBatteryEntry->battery_id }}-next-charge-time">{{ $currentBatteryEntry->next_estimated_charge_time }}</span>
<time id="battery-{{ $currentBatteryEntry->battery_id }}-next-charge-time-timeago" class="timeago timeago-contextual" datetime="{{ $currentBatteryEntry->next_estimated_charge_time }}"></time> <time id="battery-{{ $currentBatteryEntry->battery_id }}-next-charge-time-timeago"
class="timeago timeago-contextual"
datetime="{{ $currentBatteryEntry->next_estimated_charge_time }}"></time>
@else @else
... ...
@endif @endif
</td> </td>
<td class="d-none"> <td class="d-none">
"@if(FindObjectInArrayByPropertyValue($batteries, 'id', $currentBatteryEntry->battery_id)->charge_interval_days > 0 && $currentBatteryEntry->next_estimated_charge_time < date('Y-m-d H:i:s')) overdue @elseif(FindObjectInArrayByPropertyValue($batteries, 'id', $currentBatteryEntry->battery_id)->charge_interval_days > 0 && $currentBatteryEntry->next_estimated_charge_time < date('Y-m-d H:i:s', strtotime("+$nextXDays days"))) duesoon @endif "@if(FindObjectInArrayByPropertyValue($batteries, 'id', $currentBatteryEntry->battery_id)->charge_interval_days > 0 && $currentBatteryEntry->next_estimated_charge_time < date('Y-m-d
</td> H:i:s'))
overdue
@include('components.userfields_tbody', array( @elseif(FindObjectInArrayByPropertyValue($batteries, 'id'
'userfields' => $userfields, ,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $currentBatteryEntry->battery_id) $currentBatteryEntry->battery_id)->charge_interval_days > 0 && $currentBatteryEntry->next_estimated_charge_time < date('Y-m-d
)) H:i:s',
strtotime("+$nextXDays
days")))
duesoon
@endif
</td>
@include('components.userfields_tbody',
array( 'userfields'=> $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $currentBatteryEntry->battery_id)
))
</tr> </tr>
@endforeach @endforeach
@@ -122,14 +166,18 @@
</div> </div>
</div> </div>
<div class="modal fade" id="batteriesoverview-batterycard-modal" tabindex="-1"> <div class="modal fade"
id="batteriesoverview-batterycard-modal"
tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content text-center"> <div class="modal-content text-center">
<div class="modal-body"> <div class="modal-body">
@include('components.batterycard') @include('components.batterycard')
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ $__t('Close') }}</button> <button type="button"
class="btn btn-secondary"
data-dismiss="modal">{{ $__t('Close') }}</button>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -15,15 +15,16 @@
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<h4 class="mt-2">{{ $__t('Batteries overview') }}</h4> <h4 class="mt-2">{{ $__t('Batteries overview') }}</h4>
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'batteries_due_soon_days', 'id' => 'batteries_due_soon_days',
'additionalAttributes' => 'data-setting-key="batteries_due_soon_days"', 'additionalAttributes' => 'data-setting-key="batteries_due_soon_days"',
'label' => 'Batteries due to be charged soon days', 'label' => 'Batteries due to be charged soon days',
'min' => 1, 'min' => 1,
'invalidFeedback' => $__t('This cannot be lower than %s', '1'), 'invalidFeedback' => $__t('This cannot be lower than %s', '1'),
'additionalCssClasses' => 'user-setting-control' 'additionalCssClasses' => 'user-setting-control'
)) ))
<a href="{{ $U('/batteriesoverview') }}" class="btn btn-success">{{ $__t('OK') }}</a> <a href="{{ $U('/batteriesoverview') }}"
class="btn btn-success">{{ $__t('OK') }}</a>
</div> </div>
</div> </div>
@stop @stop

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit battery')) @section('title', $__t('Edit battery'))
@else @else
@section('title', $__t('Create battery')) @section('title', $__t('Create battery'))
@endif @endif
@section('viewJsName', 'batteryform') @section('viewJsName', 'batteryform')
@@ -18,46 +18,65 @@
<div class="row"> <div class="row">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<script>Grocy.EditMode = '{{ $mode }}';</script> <script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $battery->id }}</script> <script>
Grocy.EditObjectId = {{ $battery->id }}
</script>
@endif @endif
<form id="battery-form" novalidate> <form id="battery-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Name') }}</label> <label for="name">{{ $__t('Name') }}</label>
<input type="text" class="form-control" required id="name" name="name" value="@if($mode == 'edit'){{ $battery->name }}@endif"> <input type="text"
class="form-control"
required
id="name"
name="name"
value="@if($mode == 'edit'){{ $battery->name }}@endif">
<div class="invalid-feedback">{{ $__t('A name is required') }}</div> <div class="invalid-feedback">{{ $__t('A name is required') }}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="description">{{ $__t('Description') }}</label> <label for="description">{{ $__t('Description') }}</label>
<input type="text" class="form-control" id="description" name="description" value="@if($mode == 'edit'){{ $battery->description }}@endif"> <input type="text"
class="form-control"
id="description"
name="description"
value="@if($mode == 'edit'){{ $battery->description }}@endif">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Used in') }}</label> <label for="name">{{ $__t('Used in') }}</label>
<input type="text" class="form-control" id="used_in" name="used_in" value="@if($mode == 'edit'){{ $battery->used_in }}@endif"> <input type="text"
class="form-control"
id="used_in"
name="used_in"
value="@if($mode == 'edit'){{ $battery->used_in }}@endif">
</div> </div>
@php if($mode == 'edit') { $value = $battery->charge_interval_days; } else { $value = 0; } @endphp @php if($mode == 'edit') { $value = $battery->charge_interval_days; } else { $value = 0; } @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'charge_interval_days', 'id' => 'charge_interval_days',
'label' => 'Charge cycle interval (days)', 'label' => 'Charge cycle interval (days)',
'value' => $value, 'value' => $value,
'min' => '0', 'min' => '0',
'hint' => $__t('0 means suggestions for the next charge cycle are disabled'), 'hint' => $__t('0 means suggestions for the next charge cycle are disabled'),
'invalidFeedback' => $__t('This cannot be negative') 'invalidFeedback' => $__t('This cannot be negative')
)) ))
@include('components.userfieldsform', array( @include('components.userfieldsform', array(
'userfields' => $userfields, 'userfields' => $userfields,
'entity' => 'batteries' 'entity' => 'batteries'
)) ))
<button id="save-battery-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-battery-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>

View File

@@ -9,30 +9,35 @@
<div class="col-xs-12 col-md-6 col-xl-4 pb-3"> <div class="col-xs-12 col-md-6 col-xl-4 pb-3">
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<hr> <hr>
<form id="batterytracking-form" novalidate> <form id="batterytracking-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="battery_id">{{ $__t('Battery') }}</label> <label for="battery_id">{{ $__t('Battery') }}</label>
<select class="form-control combobox" id="battery_id" name="battery_id" required> <select class="form-control combobox"
id="battery_id"
name="battery_id"
required>
<option value=""></option> <option value=""></option>
@foreach($batteries as $battery) @foreach($batteries as $battery)
<option value="{{ $battery->id }}">{{ $battery->name }}</option> <option value="{{ $battery->id }}">{{ $battery->name }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('You have to select a battery') }}</div> <div class="invalid-feedback">{{ $__t('You have to select a battery') }}</div>
</div> </div>
@include('components.datetimepicker', array( @include('components.datetimepicker', array(
'id' => 'tracked_time', 'id' => 'tracked_time',
'label' => 'Tracked time', 'label' => 'Tracked time',
'format' => 'YYYY-MM-DD HH:mm:ss', 'format' => 'YYYY-MM-DD HH:mm:ss',
'initWithNow' => true, 'initWithNow' => true,
'limitEndToNow' => true, 'limitEndToNow' => true,
'limitStartToNow' => false, 'limitStartToNow' => false,
'invalidFeedback' => $__t('This can only be before now') 'invalidFeedback' => $__t('This can only be before now')
)) ))
<button id="save-batterytracking-button" class="btn btn-success">{{ $__t('OK') }}</button> <button id="save-batterytracking-button"
class="btn btn-success">{{ $__t('OK') }}</button>
</form> </form>
</div> </div>

View File

@@ -5,12 +5,13 @@
@section('viewJsName', 'calendar') @section('viewJsName', 'calendar')
@push('pageScripts') @push('pageScripts')
<script src="{{ $U('/node_modules/fullcalendar/dist/fullcalendar.min.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/node_modules/fullcalendar/dist/fullcalendar.min.js?v=', true) }}{{ $version }}"></script>
@if(!empty($__t('fullcalendar_locale') && $__t('fullcalendar_locale') != 'x'))<script src="{{ $U('/node_modules', true) }}/fullcalendar/dist/locale/{{ $__t('fullcalendar_locale') }}.js?v={{ $version }}"></script>@endif @if(!empty($__t('fullcalendar_locale') && $__t('fullcalendar_locale') != 'x'))<script src="{{ $U('/node_modules', true) }}/fullcalendar/dist/locale/{{ $__t('fullcalendar_locale') }}.js?v={{ $version }}"></script>@endif
@endpush @endpush
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/fullcalendar/dist/fullcalendar.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/fullcalendar/dist/fullcalendar.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
@endpush @endpush
@section('content') @section('content')
@@ -19,7 +20,9 @@
<div class="title-related-links"> <div class="title-related-links">
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<div class="related-links"> <div class="related-links">
<a id="ical-button" class="btn btn-outline-dark" href="#"> <a id="ical-button"
class="btn btn-outline-dark"
href="#">
{{ $__t('Share/Integrate calendar (iCal)') }} {{ $__t('Share/Integrate calendar (iCal)') }}
</a> </a>
</div> </div>

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit chore')) @section('title', $__t('Edit chore'))
@else @else
@section('title', $__t('Create chore')) @section('title', $__t('Create chore'))
@endif @endif
@section('viewJsName', 'choreform') @section('viewJsName', 'choreform')
@@ -17,30 +17,49 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<script>Grocy.EditMode = '{{ $mode }}';</script> <script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $chore->id }};</script> <script>
Grocy.EditObjectId = {{ $chore->id }};
</script>
@endif @endif
<form id="chore-form" novalidate> <form id="chore-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Name') }}</label> <label for="name">{{ $__t('Name') }}</label>
<input type="text" class="form-control" required id="name" name="name" value="@if($mode == 'edit'){{ $chore->name }}@endif"> <input type="text"
class="form-control"
required
id="name"
name="name"
value="@if($mode == 'edit'){{ $chore->name }}@endif">
<div class="invalid-feedback">{{ $__t('A name is required') }}</div> <div class="invalid-feedback">{{ $__t('A name is required') }}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="description">{{ $__t('Description') }}</label> <label for="description">{{ $__t('Description') }}</label>
<textarea class="form-control" rows="2" id="description" name="description">@if($mode == 'edit'){{ $chore->description }}@endif</textarea> <textarea class="form-control"
rows="2"
id="description"
name="description">@if($mode == 'edit'){{ $chore->description }}@endif</textarea>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="period_type">{{ $__t('Period type') }} <span id="chore-period-type-info" class="small text-muted"></span></label> <label for="period_type">{{ $__t('Period type') }} <span id="chore-period-type-info"
<select required class="form-control input-group-chore-period-type" id="period_type" name="period_type"> class="small text-muted"></span></label>
<select required
class="form-control input-group-chore-period-type"
id="period_type"
name="period_type">
@foreach($periodTypes as $periodType) @foreach($periodTypes as $periodType)
<option @if($mode == 'edit' && $periodType == $chore->period_type) selected="selected" @endif value="{{ $periodType }}">{{ $__t($periodType) }}</option> <option @if($mode=='edit'
&&
$periodType==$chore->period_type) selected="selected" @endif value="{{ $periodType }}">{{ $__t($periodType) }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('A period type is required') }}</div> <div class="invalid-feedback">{{ $__t('A period type is required') }}</div>
@@ -48,66 +67,103 @@
@php if($mode == 'edit') { $value = $chore->period_days; } else { $value = 0; } @endphp @php if($mode == 'edit') { $value = $chore->period_days; } else { $value = 0; } @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'period_days', 'id' => 'period_days',
'label' => 'Period days', 'label' => 'Period days',
'value' => $value, 'value' => $value,
'min' => '0', 'min' => '0',
'additionalCssClasses' => 'input-group-chore-period-type', 'additionalCssClasses' => 'input-group-chore-period-type',
'invalidFeedback' => $__t('This cannot be negative'), 'invalidFeedback' => $__t('This cannot be negative'),
'additionalGroupCssClasses' => 'period-type-input period-type-dynamic-regular period-type-monthly' 'additionalGroupCssClasses' => 'period-type-input period-type-dynamic-regular period-type-monthly'
)) ))
<div class="form-group period-type-input period-type-weekly"> <div class="form-group period-type-input period-type-weekly">
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<input class="form-check-input input-group-chore-period-type" type="checkbox" id="monday" value="monday"> <input class="form-check-input input-group-chore-period-type"
<label class="form-check-label" for="monday">{{ $__t('Monday') }}</label> type="checkbox"
id="monday"
value="monday">
<label class="form-check-label"
for="monday">{{ $__t('Monday') }}</label>
</div> </div>
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<input class="form-check-input input-group-chore-period-type" type="checkbox" id="tuesday" value="tuesday"> <input class="form-check-input input-group-chore-period-type"
<label class="form-check-label" for="tuesday">{{ $__t('Tuesday') }}</label> type="checkbox"
id="tuesday"
value="tuesday">
<label class="form-check-label"
for="tuesday">{{ $__t('Tuesday') }}</label>
</div> </div>
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<input class="form-check-input input-group-chore-period-type" type="checkbox" id="wednesday" value="wednesday"> <input class="form-check-input input-group-chore-period-type"
<label class="form-check-label" for="wednesday">{{ $__t('Wednesday') }}</label> type="checkbox"
id="wednesday"
value="wednesday">
<label class="form-check-label"
for="wednesday">{{ $__t('Wednesday') }}</label>
</div> </div>
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<input class="form-check-input input-group-chore-period-type" type="checkbox" id="thursday" value="thursday"> <input class="form-check-input input-group-chore-period-type"
<label class="form-check-label" for="thursday">{{ $__t('Thursday') }}</label> type="checkbox"
id="thursday"
value="thursday">
<label class="form-check-label"
for="thursday">{{ $__t('Thursday') }}</label>
</div> </div>
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<input class="form-check-input input-group-chore-period-type" type="checkbox" id="friday" value="friday"> <input class="form-check-input input-group-chore-period-type"
<label class="form-check-label" for="friday">{{ $__t('Friday') }}</label> type="checkbox"
id="friday"
value="friday">
<label class="form-check-label"
for="friday">{{ $__t('Friday') }}</label>
</div> </div>
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<input class="form-check-input input-group-chore-period-type" type="checkbox" id="saturday" value="saturday"> <input class="form-check-input input-group-chore-period-type"
<label class="form-check-label" for="saturday">{{ $__t('Saturday') }}</label> type="checkbox"
id="saturday"
value="saturday">
<label class="form-check-label"
for="saturday">{{ $__t('Saturday') }}</label>
</div> </div>
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<input class="form-check-input input-group-chore-period-type" type="checkbox" id="sunday" value="sunday"> <input class="form-check-input input-group-chore-period-type"
<label class="form-check-label" for="sunday">{{ $__t('Sunday') }}</label> type="checkbox"
id="sunday"
value="sunday">
<label class="form-check-label"
for="sunday">{{ $__t('Sunday') }}</label>
</div> </div>
</div> </div>
<input type="hidden" id="period_config" name="period_config" value="@if($mode == 'edit'){{ $chore->period_config }}@endif"> <input type="hidden"
id="period_config"
name="period_config"
value="@if($mode == 'edit'){{ $chore->period_config }}@endif">
@php if($mode == 'edit') { $value = $chore->period_interval; } else { $value = 1; } @endphp @php if($mode == 'edit') { $value = $chore->period_interval; } else { $value = 1; } @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'period_interval', 'id' => 'period_interval',
'label' => 'Period interval', 'label' => 'Period interval',
'value' => $value, 'value' => $value,
'min' => '1', 'min' => '1',
'additionalCssClasses' => 'input-group-chore-period-type', 'additionalCssClasses' => 'input-group-chore-period-type',
'invalidFeedback' => $__t('This cannot be lower than %s', '1'), 'invalidFeedback' => $__t('This cannot be lower than %s', '1'),
'additionalGroupCssClasses' => 'period-type-input period-type-daily period-type-weekly period-type-monthly period-type-yearly', 'additionalGroupCssClasses' => 'period-type-input period-type-daily period-type-weekly period-type-monthly period-type-yearly',
'hintId' => 'chore-period-interval-info' 'hintId' => 'chore-period-interval-info'
)) ))
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS) @if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
<div class="form-group"> <div class="form-group">
<label for="assignment_type">{{ $__t('Assignment type') }} <span id="chore-assignment-type-info" class="small text-muted"></span></label> <label for="assignment_type">{{ $__t('Assignment type') }} <span id="chore-assignment-type-info"
<select required class="form-control input-group-chore-assignment-type" id="assignment_type" name="assignment_type"> class="small text-muted"></span></label>
<select required
class="form-control input-group-chore-assignment-type"
id="assignment_type"
name="assignment_type">
@foreach($assignmentTypes as $assignmentType) @foreach($assignmentTypes as $assignmentType)
<option @if($mode == 'edit' && $assignmentType == $chore->assignment_type) selected="selected" @endif value="{{ $assignmentType }}">{{ $__t($assignmentType) }}</option> <option @if($mode=='edit'
&&
$assignmentType==$chore->assignment_type) selected="selected" @endif value="{{ $assignmentType }}">{{ $__t($assignmentType) }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('An assignment type is required') }}</div> <div class="invalid-feedback">{{ $__t('An assignment type is required') }}</div>
@@ -115,23 +171,42 @@
<div class="form-group"> <div class="form-group">
<label for="assignment_config">{{ $__t('Assign to') }}</label> <label for="assignment_config">{{ $__t('Assign to') }}</label>
<select required multiple class="form-control input-group-chore-assignment-type selectpicker" id="assignment_config" name="assignment_config" data-actions-Box="true" data-live-search="true"> <select required
multiple
class="form-control input-group-chore-assignment-type selectpicker"
id="assignment_config"
name="assignment_config"
data-actions-Box="true"
data-live-search="true">
@foreach($users as $user) @foreach($users as $user)
<option @if($mode == 'edit' && in_array($user->id, explode(',', $chore->assignment_config))) selected="selected" @endif value="{{ $user->id }}">{{ $user->display_name }}</option> <option @if($mode=='edit'
&&
in_array($user->id, explode(',', $chore->assignment_config))) selected="selected" @endif value="{{ $user->id }}">{{ $user->display_name }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('This assignment type requires that at least one is assigned') }}</div> <div class="invalid-feedback">{{ $__t('This assignment type requires that at least one is assigned') }}</div>
</div> </div>
@else @else
<input type="hidden" id="assignment_type" name="assignment_type" value="{{ \Grocy\Services\ChoresService::CHORE_ASSIGNMENT_TYPE_NO_ASSIGNMENT }}"> <input type="hidden"
<input type="hidden" id="assignment_config" name="assignment_config" value=""> 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="">
@endif @endif
<div class="form-group"> <div class="form-group">
<div class="form-check"> <div class="form-check">
<input type="hidden" name="track_date_only" value="0"> <input type="hidden"
<input @if($mode == 'edit' && $chore->track_date_only == 1) checked @endif class="form-check-input" type="checkbox" id="track_date_only" name="track_date_only" value="1"> name="track_date_only"
<label class="form-check-label" for="track_date_only">{{ $__t('Track date only') }} value="0">
<input @if($mode=='edit'
&&
$chore->track_date_only == 1) checked @endif class="form-check-input" type="checkbox" id="track_date_only" name="track_date_only" value="1">
<label class="form-check-label"
for="track_date_only">{{ $__t('Track date only') }}
<span class="text-muted small">{{ $__t('When enabled only the day of an execution is tracked, not the time') }}</span> <span class="text-muted small">{{ $__t('When enabled only the day of an execution is tracked, not the time') }}</span>
</label> </label>
</div> </div>
@@ -139,9 +214,14 @@
<div class="form-group"> <div class="form-group">
<div class="form-check"> <div class="form-check">
<input type="hidden" name="rollover" value="0"> <input type="hidden"
<input @if($mode == 'edit' && $chore->rollover == 1) checked @endif class="form-check-input" type="checkbox" id="rollover" name="rollover" value="1"> name="rollover"
<label class="form-check-label" for="rollover">{{ $__t('Due date rollover') }} value="0">
<input @if($mode=='edit'
&&
$chore->rollover == 1) checked @endif class="form-check-input" type="checkbox" id="rollover" name="rollover" value="1">
<label class="form-check-label"
for="rollover">{{ $__t('Due date rollover') }}
<span class="text-muted small">{{ $__t('When enabled the chore can never be overdue, the due date will shift forward each day when due') }}</span> <span class="text-muted small">{{ $__t('When enabled the chore can never be overdue, the due date will shift forward each day when due') }}</span>
</label> </label>
</div> </div>
@@ -150,40 +230,46 @@
@if(GROCY_FEATURE_FLAG_STOCK) @if(GROCY_FEATURE_FLAG_STOCK)
<div class="form-group mt-4 mb-1"> <div class="form-group mt-4 mb-1">
<div class="form-check"> <div class="form-check">
<input type="hidden" name="consume_product_on_execution" value="0"> <input type="hidden"
<input @if($mode == 'edit' && $chore->consume_product_on_execution == 1) checked @endif class="form-check-input" type="checkbox" id="consume_product_on_execution" name="consume_product_on_execution" value="1"> name="consume_product_on_execution"
<label class="form-check-label" for="consume_product_on_execution">{{ $__t('Consume product on chore execution') }}</label> value="0">
<input @if($mode=='edit'
&&
$chore->consume_product_on_execution == 1) checked @endif class="form-check-input" type="checkbox" id="consume_product_on_execution" name="consume_product_on_execution" value="1">
<label class="form-check-label"
for="consume_product_on_execution">{{ $__t('Consume product on chore execution') }}</label>
</div> </div>
</div> </div>
@php $prefillById = ''; if($mode=='edit' && !empty($chore->product_id)) { $prefillById = $chore->product_id; } @endphp @php $prefillById = ''; if($mode=='edit' && !empty($chore->product_id)) { $prefillById = $chore->product_id; } @endphp
@include('components.productpicker', array( @include('components.productpicker', array(
'products' => $products, 'products' => $products,
'nextInputSelector' => '#product_amount', 'nextInputSelector' => '#product_amount',
'isRequired' => false, 'isRequired' => false,
'disallowAllProductWorkflows' => true, 'disallowAllProductWorkflows' => true,
'prefillById' => $prefillById 'prefillById' => $prefillById
)) ))
@php if($mode == 'edit') { $value = $chore->product_amount; } else { $value = ''; } @endphp @php if($mode == 'edit') { $value = $chore->product_amount; } else { $value = ''; } @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'product_amount', 'id' => 'product_amount',
'label' => 'Amount', 'label' => 'Amount',
'hintId' => 'amount_qu_unit', 'hintId' => 'amount_qu_unit',
'min' => 0.0001, 'min' => 0.0001,
'step' => 0.0001, 'step' => 0.0001,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'), 'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
'isRequired' => false, 'isRequired' => false,
'value' => $value 'value' => $value
)) ))
@endif @endif
@include('components.userfieldsform', array( @include('components.userfieldsform', array(
'userfields' => $userfields, 'userfields' => $userfields,
'entity' => 'chores' 'entity' => 'chores'
)) ))
<button id="save-chore-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-chore-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>

View File

@@ -10,7 +10,8 @@
<div class="title-related-links"> <div class="title-related-links">
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<div class="related-links"> <div class="related-links">
<a class="btn btn-outline-secondary" href="{{ $U('/userfields?entity=chores') }}"> <a class="btn btn-outline-secondary"
href="{{ $U('/userfields?entity=chores') }}">
{{ $__t('Configure userfields') }} {{ $__t('Configure userfields') }}
</a> </a>
</div> </div>
@@ -20,7 +21,8 @@
<hr> <hr>
<div class="row mt-3"> <div class="row mt-3">
<div class="col-xs-12 col-md-2 col-xl-1"> <div class="col-xs-12 col-md-2 col-xl-1">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3" href="{{ $U('/chore/new') }}"> <a class="btn btn-primary btn-sm responsive-button w-100 mb-3"
href="{{ $U('/chore/new') }}">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
@@ -29,58 +31,66 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="chores-table" class="table table-sm table-striped dt-responsive"> <table id="chores-table"
<thead> class="table table-sm table-striped dt-responsive">
<tr> <thead>
<th class="border-right"></th> <tr>
<th>{{ $__t('Name') }}</th> <th class="border-right"></th>
<th>{{ $__t('Period type') }}</th> <th>{{ $__t('Name') }}</th>
<th>{{ $__t('Description') }}</th> <th>{{ $__t('Period type') }}</th>
<th>{{ $__t('Description') }}</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
</thead> </thead>
<tbody class="d-none"> <tbody class="d-none">
@foreach($chores as $chore) @foreach($chores as $chore)
<tr> <tr>
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-info btn-sm" href="{{ $U('/chore/') }}{{ $chore->id }}"> <a class="btn btn-info btn-sm"
<i class="fas fa-edit"></i> href="{{ $U('/chore/') }}{{ $chore->id }}">
</a> <i class="fas fa-edit"></i>
<a class="btn btn-danger btn-sm chore-delete-button" href="#" data-chore-id="{{ $chore->id }}" data-chore-name="{{ $chore->name }}"> </a>
<i class="fas fa-trash"></i> <a class="btn btn-danger btn-sm chore-delete-button"
</a> href="#"
</td> data-chore-id="{{ $chore->id }}"
<td> data-chore-name="{{ $chore->name }}">
{{ $chore->name }} <i class="fas fa-trash"></i>
</td> </a>
<td> </td>
{{ $__t($chore->period_type) }} <td>
</td> {{ $chore->name }}
<td> </td>
{{ $chore->description }} <td>
</td> {{ $__t($chore->period_type) }}
</td>
<td>
{{ $chore->description }}
</td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $chore->id) 'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $chore->id)
)) ))
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>

View File

@@ -16,20 +16,24 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-filter"></i></span> <span class="input-group-text"><i class="fas fa-filter"></i></span>
</div> </div>
<select class="form-control" id="chore-filter"> <select class="form-control"
id="chore-filter">
<option value="all">{{ $__t('All') }}</option> <option value="all">{{ $__t('All') }}</option>
@foreach($chores as $chore) @foreach($chores as $chore)
<option value="{{ $chore->id }}">{{ $chore->name }}</option> <option value="{{ $chore->id }}">{{ $chore->name }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
@@ -38,7 +42,8 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="chores-journal-table" class="table table-sm table-striped dt-responsive"> <table id="chores-journal-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -51,9 +56,15 @@
</thead> </thead>
<tbody class="d-none"> <tbody class="d-none">
@foreach($choresLog as $choreLogEntry) @foreach($choresLog as $choreLogEntry)
<tr id="chore-execution-{{ $choreLogEntry->id }}-row" class="@if($choreLogEntry->undone == 1) text-muted @endif"> <tr id="chore-execution-{{ $choreLogEntry->id }}-row"
class="@if($choreLogEntry->undone == 1) text-muted @endif">
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-secondary btn-sm undo-chore-execution-button permission-CHORE_UNDO_EXECUTION @if($choreLogEntry->undone == 1) disabled @endif" href="#" data-execution-id="{{ $choreLogEntry->id }}" data-toggle="tooltip" data-placement="left" title="{{ $__t('Undo chore execution') }}"> <a class="btn btn-secondary btn-sm undo-chore-execution-button permission-CHORE_UNDO_EXECUTION @if($choreLogEntry->undone == 1) disabled @endif"
href="#"
data-execution-id="{{ $choreLogEntry->id }}"
data-toggle="tooltip"
data-placement="left"
title="{{ $__t('Undo chore execution') }}">
<i class="fas fa-undo"></i> <i class="fas fa-undo"></i>
</a> </a>
</td> </td>
@@ -62,12 +73,14 @@
@if($choreLogEntry->undone == 1) @if($choreLogEntry->undone == 1)
<br> <br>
{{ $__t('Undone on') . ' ' . $choreLogEntry->undone_timestamp }} {{ $__t('Undone on') . ' ' . $choreLogEntry->undone_timestamp }}
<time class="timeago timeago-contextual" datetime="{{ $choreLogEntry->undone_timestamp }}"></time> <time class="timeago timeago-contextual"
datetime="{{ $choreLogEntry->undone_timestamp }}"></time>
@endif @endif
</td> </td>
<td> <td>
<span>{{ $choreLogEntry->tracked_time }}</span> <span>{{ $choreLogEntry->tracked_time }}</span>
<time class="timeago timeago-contextual @if(FindObjectInArrayByPropertyValue($chores, 'id', $choreLogEntry->chore_id)->track_date_only == 1) timeago-date-only @endif" datetime="{{ $choreLogEntry->tracked_time }}"></time> <time class="timeago timeago-contextual @if(FindObjectInArrayByPropertyValue($chores, 'id', $choreLogEntry->chore_id)->track_date_only == 1) timeago-date-only @endif"
datetime="{{ $choreLogEntry->tracked_time }}"></time>
</td> </td>
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS) @if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
<td> <td>

View File

@@ -5,7 +5,8 @@
@section('viewJsName', 'choresoverview') @section('viewJsName', 'choresoverview')
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
@endpush @endpush
@section('content') @section('content')
@@ -14,16 +15,24 @@
<div class="title-related-links"> <div class="title-related-links">
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<div class="related-links"> <div class="related-links">
<a class="btn btn-outline-dark responsive-button" href="{{ $U('/choresjournal') }}"> <a class="btn btn-outline-dark responsive-button"
href="{{ $U('/choresjournal') }}">
{{ $__t('Journal') }} {{ $__t('Journal') }}
</a> </a>
</div> </div>
</div> </div>
<hr> <hr>
<p id="info-due-chores" data-status-filter="duesoon" data-next-x-days="{{ $nextXDays }}" class="warning-message status-filter-message responsive-message mr-2"></p> <p id="info-due-chores"
<p id="info-overdue-chores" data-status-filter="overdue" class="error-message status-filter-message responsive-button mr-2"></p> data-status-filter="duesoon"
data-next-x-days="{{ $nextXDays }}"
class="warning-message status-filter-message responsive-message mr-2"></p>
<p id="info-overdue-chores"
data-status-filter="overdue"
class="error-message status-filter-message responsive-button mr-2"></p>
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS) @if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
<p id="info-assigned-to-me-chores" data-user-filter="xx{{ GROCY_USER_ID }}xx" class="normal-message user-filter-message responsive-button"></p> <p id="info-assigned-to-me-chores"
data-user-filter="xx{{ GROCY_USER_ID }}xx"
class="normal-message user-filter-message responsive-button"></p>
@endif @endif
</div> </div>
</div> </div>
@@ -32,18 +41,22 @@
<div class="col-xs-12 col-md-6 col-xl-3 d-flex align-items-end"> <div class="col-xs-12 col-md-6 col-xl-3 d-flex align-items-end">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<label for="status-filter">{{ $__t('Status') }}</label> <label for="status-filter">{{ $__t('Status') }}</label>
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-filter"></i></span> <span class="input-group-text"><i class="fas fa-filter"></i></span>
</div> </div>
<select class="form-control" id="status-filter"> <select class="form-control"
id="status-filter">
<option value="all">{{ $__t('All') }}</option> <option value="all">{{ $__t('All') }}</option>
<option value="duesoon">{{ $__t('Due soon') }}</option> <option value="duesoon">{{ $__t('Due soon') }}</option>
<option value="overdue">{{ $__t('Overdue') }}</option> <option value="overdue">{{ $__t('Overdue') }}</option>
@@ -55,12 +68,14 @@
<label for="user-filter">{{ $__t('Assignment') }}</label> <label for="user-filter">{{ $__t('Assignment') }}</label>
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-filter"></i></span> <span class="input-group-text"><i class="fas fa-filter"></i></span>
</div> </div>
<select class="form-control" id="user-filter"> <select class="form-control"
id="user-filter">
<option></option> <option></option>
@foreach($users as $user) @foreach($users as $user)
<option data-user-id="{{ $user->id }}" value="xx{{ $user->id }}xx">{{ $user->display_name }}</option> <option data-user-id="{{ $user->id }}"
value="xx{{ $user->id }}xx">{{ $user->display_name }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
@@ -70,7 +85,8 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="chores-overview-table" class="table table-sm table-striped dt-responsive"> <table id="chores-overview-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -86,77 +102,112 @@
@endif @endif
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
</thead> </thead>
<tbody class="d-none"> <tbody class="d-none">
@foreach($currentChores as $curentChoreEntry) @foreach($currentChores as $curentChoreEntry)
<tr id="chore-{{ $curentChoreEntry->chore_id }}-row" class="@if(FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->period_type !== \Grocy\Services\ChoresService::CHORE_PERIOD_TYPE_MANUALLY && $curentChoreEntry->next_estimated_execution_time < date('Y-m-d H:i:s')) table-danger @elseif(FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->period_type !== \Grocy\Services\ChoresService::CHORE_PERIOD_TYPE_MANUALLY && $curentChoreEntry->next_estimated_execution_time < date('Y-m-d H:i:s', strtotime("+$nextXDays days"))) table-warning @endif"> <tr id="chore-{{ $curentChoreEntry->chore_id }}-row"
class="@if(FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->period_type !== \Grocy\Services\ChoresService::CHORE_PERIOD_TYPE_MANUALLY && $curentChoreEntry->next_estimated_execution_time < date('Y-m-d H:i:s')) table-danger @elseif(FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->period_type !== \Grocy\Services\ChoresService::CHORE_PERIOD_TYPE_MANUALLY && $curentChoreEntry->next_estimated_execution_time < date('Y-m-d H:i:s', strtotime("
+$nextXDays
days")))
table-warning
@endif">
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-success btn-sm track-chore-button permission-CHORE_TRACK_EXECUTION" href="#" data-toggle="tooltip" data-placement="left" title="{{ $__t('Track execution of chore %s', FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->name) }}" <a class="btn btn-success btn-sm track-chore-button permission-CHORE_TRACK_EXECUTION"
href="#"
data-toggle="tooltip"
data-placement="left"
title="{{ $__t('Track execution of chore %s', FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->name) }}"
data-chore-id="{{ $curentChoreEntry->chore_id }}" data-chore-id="{{ $curentChoreEntry->chore_id }}"
data-chore-name="{{ FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->name }}"> data-chore-name="{{ FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->name }}">
<i class="fas fa-play"></i> <i class="fas fa-play"></i>
</a> </a>
<div class="dropdown d-inline-block"> <div class="dropdown d-inline-block">
<button class="btn btn-sm btn-light text-secondary" type="button" data-toggle="dropdown"> <button class="btn btn-sm btn-light text-secondary"
type="button"
data-toggle="dropdown">
<i class="fas fa-ellipsis-v"></i> <i class="fas fa-ellipsis-v"></i>
</button> </button>
<div class="table-inline-menu dropdown-menu dropdown-menu-right"> <div class="table-inline-menu dropdown-menu dropdown-menu-right">
<a class="dropdown-item chore-name-cell" data-chore-id="{{ $curentChoreEntry->chore_id }}" type="button" href="#"> <a class="dropdown-item chore-name-cell"
data-chore-id="{{ $curentChoreEntry->chore_id }}"
type="button"
href="#">
<span class="dropdown-item-icon"><i class="fas fa-info"></i></span> <span class="dropdown-item-text">{{ $__t('Show chore details') }}</span> <span class="dropdown-item-icon"><i class="fas fa-info"></i></span> <span class="dropdown-item-text">{{ $__t('Show chore details') }}</span>
</a> </a>
<a class="dropdown-item" type="button" href="{{ $U('/choresjournal?chore=') }}{{ $curentChoreEntry->chore_id }}"> <a class="dropdown-item"
type="button"
href="{{ $U('/choresjournal?chore=') }}{{ $curentChoreEntry->chore_id }}">
<span class="dropdown-item-icon"><i class="fas fa-file-alt"></i></span> <span class="dropdown-item-text">{{ $__t('Journal for this chore') }}</span> <span class="dropdown-item-icon"><i class="fas fa-file-alt"></i></span> <span class="dropdown-item-text">{{ $__t('Journal for this chore') }}</span>
</a> </a>
<a class="dropdown-item permission-MASTER_DATA_EDIT" type="button" href="{{ $U('/chore/') }}{{ $curentChoreEntry->chore_id }}"> <a class="dropdown-item permission-MASTER_DATA_EDIT"
type="button"
href="{{ $U('/chore/') }}{{ $curentChoreEntry->chore_id }}">
<span class="dropdown-item-icon"><i class="fas fa-edit"></i></span> <span class="dropdown-item-text">{{ $__t('Edit chore') }}</span> <span class="dropdown-item-icon"><i class="fas fa-edit"></i></span> <span class="dropdown-item-text">{{ $__t('Edit chore') }}</span>
</a> </a>
</div> </div>
</div> </div>
</td> </td>
<td class="chore-name-cell cursor-link" data-chore-id="{{ $curentChoreEntry->chore_id }}"> <td class="chore-name-cell cursor-link"
data-chore-id="{{ $curentChoreEntry->chore_id }}">
{{ FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->name }} {{ FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->name }}
</td> </td>
<td> <td>
@if(FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->period_type !== \Grocy\Services\ChoresService::CHORE_PERIOD_TYPE_MANUALLY) @if(FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->period_type !== \Grocy\Services\ChoresService::CHORE_PERIOD_TYPE_MANUALLY)
<span id="chore-{{ $curentChoreEntry->chore_id }}-next-execution-time">{{ $curentChoreEntry->next_estimated_execution_time }}</span> <span id="chore-{{ $curentChoreEntry->chore_id }}-next-execution-time">{{ $curentChoreEntry->next_estimated_execution_time }}</span>
<time id="chore-{{ $curentChoreEntry->chore_id }}-next-execution-time-timeago" class="timeago timeago-contextual @if($curentChoreEntry->track_date_only == 1) timeago-date-only @endif" datetime="{{ $curentChoreEntry->next_estimated_execution_time }}"></time> <time id="chore-{{ $curentChoreEntry->chore_id }}-next-execution-time-timeago"
class="timeago timeago-contextual @if($curentChoreEntry->track_date_only == 1) timeago-date-only @endif"
datetime="{{ $curentChoreEntry->next_estimated_execution_time }}"></time>
@else @else
<span>-</span> <span>-</span>
@endif @endif
</td> </td>
<td> <td>
<span id="chore-{{ $curentChoreEntry->chore_id }}-last-tracked-time">{{ $curentChoreEntry->last_tracked_time }}</span> <span id="chore-{{ $curentChoreEntry->chore_id }}-last-tracked-time">{{ $curentChoreEntry->last_tracked_time }}</span>
<time id="chore-{{ $curentChoreEntry->chore_id }}-last-tracked-time-timeago" class="timeago timeago-contextual @if($curentChoreEntry->track_date_only == 1) timeago-date-only @endif" datetime="{{ $curentChoreEntry->last_tracked_time }}"></time> <time id="chore-{{ $curentChoreEntry->chore_id }}-last-tracked-time-timeago"
class="timeago timeago-contextual @if($curentChoreEntry->track_date_only == 1) timeago-date-only @endif"
datetime="{{ $curentChoreEntry->last_tracked_time }}"></time>
</td> </td>
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS) @if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
<td> <td>
<span id="chore-{{ $curentChoreEntry->chore_id }}-next-execution-assigned-user"> <span id="chore-{{ $curentChoreEntry->chore_id }}-next-execution-assigned-user">
@if(!empty($curentChoreEntry->next_execution_assigned_to_user_id)) @if(!empty($curentChoreEntry->next_execution_assigned_to_user_id))
{{ FindObjectInArrayByPropertyValue($users, 'id', $curentChoreEntry->next_execution_assigned_to_user_id)->display_name }} {{ FindObjectInArrayByPropertyValue($users, 'id', $curentChoreEntry->next_execution_assigned_to_user_id)->display_name }}
@else @else
<span>-</span> <span>-</span>
@endif @endif
</span> </span>
</td> </td>
@endif @endif
<td id="chore-{{ $curentChoreEntry->chore_id }}-due-filter-column" class="d-none"> <td id="chore-{{ $curentChoreEntry->chore_id }}-due-filter-column"
@if(FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->period_type !== \Grocy\Services\ChoresService::CHORE_PERIOD_TYPE_MANUALLY && $curentChoreEntry->next_estimated_execution_time < date('Y-m-d H:i:s')) overdue @elseif(FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->period_type !== \Grocy\Services\ChoresService::CHORE_PERIOD_TYPE_MANUALLY && $curentChoreEntry->next_estimated_execution_time < date('Y-m-d H:i:s', strtotime("+$nextXDays days"))) duesoon @endif class="d-none">
</td> @if(FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->period_type !== \Grocy\Services\ChoresService::CHORE_PERIOD_TYPE_MANUALLY && $curentChoreEntry->next_estimated_execution_time < date('Y-m-d
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS) H:i:s'))
<td class="d-none"> overdue
@if(!empty($curentChoreEntry->next_execution_assigned_to_user_id)) @elseif(FindObjectInArrayByPropertyValue($chores, 'id'
xx{{ $curentChoreEntry->next_execution_assigned_to_user_id }}xx ,
@endif $curentChoreEntry->chore_id)->period_type !== \Grocy\Services\ChoresService::CHORE_PERIOD_TYPE_MANUALLY && $curentChoreEntry->next_estimated_execution_time < date('Y-m-d
H:i:s',
strtotime("+$nextXDays
days")))
duesoon
@endif
</td>
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
<td
class="d-none">
@if(!empty($curentChoreEntry->next_execution_assigned_to_user_id))
xx{{ $curentChoreEntry->next_execution_assigned_to_user_id }}xx
@endif
</td> </td>
@endif @endif
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $curentChoreEntry->chore_id) 'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $curentChoreEntry->chore_id)
)) ))
</tr> </tr>
@@ -166,14 +217,18 @@
</div> </div>
</div> </div>
<div class="modal fade" id="choresoverview-chorecard-modal" tabindex="-1"> <div class="modal fade"
id="choresoverview-chorecard-modal"
tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content text-center"> <div class="modal-content text-center">
<div class="modal-body"> <div class="modal-body">
@include('components.chorecard') @include('components.chorecard')
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ $__t('Close') }}</button> <button type="button"
class="btn btn-secondary"
data-dismiss="modal">{{ $__t('Close') }}</button>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -15,15 +15,16 @@
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<h4 class="mt-2">{{ $__t('Chores overview') }}</h4> <h4 class="mt-2">{{ $__t('Chores overview') }}</h4>
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'chores_due_soon_days', 'id' => 'chores_due_soon_days',
'additionalAttributes' => 'data-setting-key="chores_due_soon_days"', 'additionalAttributes' => 'data-setting-key="chores_due_soon_days"',
'label' => 'Chores due soon days', 'label' => 'Chores due soon days',
'min' => 1, 'min' => 1,
'invalidFeedback' => $__t('This cannot be lower than %s', '1'), 'invalidFeedback' => $__t('This cannot be lower than %s', '1'),
'additionalCssClasses' => 'user-setting-control' 'additionalCssClasses' => 'user-setting-control'
)) ))
<a href="{{ $U('/choresoverview') }}" class="btn btn-success">{{ $__t('OK') }}</a> <a href="{{ $U('/choresoverview') }}"
class="btn btn-success">{{ $__t('OK') }}</a>
</div> </div>
</div> </div>
@stop @stop

View File

@@ -9,41 +9,49 @@
<div class="col-xs-12 col-md-6 col-xl-4 pb-3"> <div class="col-xs-12 col-md-6 col-xl-4 pb-3">
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<hr> <hr>
<form id="choretracking-form" novalidate> <form id="choretracking-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="chore_id">{{ $__t('Chore') }}</label> <label for="chore_id">{{ $__t('Chore') }}</label>
<select class="form-control combobox" id="chore_id" name="chore_id" required> <select class="form-control combobox"
id="chore_id"
name="chore_id"
required>
<option value=""></option> <option value=""></option>
@foreach($chores as $chore) @foreach($chores as $chore)
<option value="{{ $chore->id }}">{{ $chore->name }}</option> <option value="{{ $chore->id }}">{{ $chore->name }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('You have to select a chore') }}</div> <div class="invalid-feedback">{{ $__t('You have to select a chore') }}</div>
</div> </div>
@include('components.datetimepicker', array( @include('components.datetimepicker', array(
'id' => 'tracked_time', 'id' => 'tracked_time',
'label' => 'Tracked time', 'label' => 'Tracked time',
'format' => 'YYYY-MM-DD HH:mm:ss', 'format' => 'YYYY-MM-DD HH:mm:ss',
'initWithNow' => true, 'initWithNow' => true,
'limitEndToNow' => true, 'limitEndToNow' => true,
'limitStartToNow' => false, 'limitStartToNow' => false,
'invalidFeedback' => $__t('This can only be before now') 'invalidFeedback' => $__t('This can only be before now')
)) ))
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS) @if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
@include('components.userpicker', array( @include('components.userpicker', array(
'label' => 'Done by', 'label' => 'Done by',
'users' => $users, 'users' => $users,
'nextInputSelector' => '#user_id', 'nextInputSelector' => '#user_id',
'prefillByUserId' => GROCY_USER_ID 'prefillByUserId' => GROCY_USER_ID
)) ))
@else @else
<input type="hidden" id="user_id" name="user_id" value="{{ GROCY_USER_ID }}"> <input type="hidden"
id="user_id"
name="user_id"
value="{{ GROCY_USER_ID }}">
@endif @endif
<button id="save-choretracking-button" class="btn btn-success">{{ $__t('OK') }}</button> <button id="save-choretracking-button"
class="btn btn-success">{{ $__t('OK') }}</button>
</form> </form>
</div> </div>

View File

@@ -1,27 +1,28 @@
@if (!GROCY_DISABLE_BROWSER_BARCODE_CAMERA_SCANNING) @if (!GROCY_DISABLE_BROWSER_BARCODE_CAMERA_SCANNING)
@push('componentScripts') @push('componentScripts')
<script src="{{ $U('/viewjs/components/barcodescanner.js', true) }}?v={{ $version }}"></script> <script src="{{ $U('/viewjs/components/barcodescanner.js', true) }}?v={{ $version }}"></script>
@endpush @endpush
@push('pageScripts') @push('pageScripts')
<script src="{{ $U('/node_modules/@ericblade/quagga2/dist/quagga.min.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/node_modules/@ericblade/quagga2/dist/quagga.min.js?v=', true) }}{{ $version }}"></script>
@endpush @endpush
@push('pageStyles') @push('pageStyles')
<style> <style>
#barcodescanner-start-button { #barcodescanner-start-button {
position: absolute; position: absolute;
right: 0; right: 0;
margin-top: 4px; margin-top: 4px;
margin-right: 5px; margin-right: 5px;
cursor: pointer; cursor: pointer;
} }
.combobox-container #barcodescanner-start-button { .combobox-container #barcodescanner-start-button {
margin-right: 36px !important; margin-right: 36px !important;
} }
</style>
</style>
@endpush @endpush
@endif @endif

View File

@@ -1,21 +1,31 @@
@push('componentScripts') @push('componentScripts')
<script src="{{ $U('/viewjs/components/batterycard.js', true) }}?v={{ $version }}"></script> <script src="{{ $U('/viewjs/components/batterycard.js', true) }}?v={{ $version }}"></script>
@endpush @endpush
<div class="card batterycard"> <div class="card batterycard">
<div class="card-header"> <div class="card-header">
<i class="fas fa-battery-three-quarters"></i> {{ $__t('Battery overview') }} <i class="fas fa-battery-three-quarters"></i> {{ $__t('Battery overview') }}
<a id="batterycard-battery-edit-button" class="btn btn-sm btn-outline-info py-0 float-right disabled" href="#" data-toggle="tooltip" title="{{ $__t('Edit battery') }}"> <a id="batterycard-battery-edit-button"
class="btn btn-sm btn-outline-info py-0 float-right disabled"
href="#"
data-toggle="tooltip"
title="{{ $__t('Edit battery') }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a id="batterycard-battery-journal-button" class="btn btn-sm btn-outline-secondary py-0 mr-2 float-right disabled show-as-dialog-link" href="#" data-toggle="tooltip" title="{{ $__t('Journal for this battery') }}"> <a id="batterycard-battery-journal-button"
class="btn btn-sm btn-outline-secondary py-0 mr-2 float-right disabled show-as-dialog-link"
href="#"
data-toggle="tooltip"
title="{{ $__t('Journal for this battery') }}">
<i class="fas fa-file-alt"></i> <i class="fas fa-file-alt"></i>
</a> </a>
</div> </div>
<div class="card-body"> <div class="card-body">
<h3><span id="batterycard-battery-name"></span></h3> <h3><span id="batterycard-battery-name"></span></h3>
<strong>{{ $__t('Used in') }}:</strong> <span id="batterycard-battery-used_in"></span><br> <strong>{{ $__t('Used in') }}:</strong> <span id="batterycard-battery-used_in"></span><br>
<strong>{{ $__t('Charge cycles count') }}:</strong> <span id="batterycard-battery-charge-cycles-count" class="locale-number locale-number-generic"></span><br> <strong>{{ $__t('Charge cycles count') }}:</strong> <span id="batterycard-battery-charge-cycles-count"
<strong>{{ $__t('Last charged') }}:</strong> <span id="batterycard-battery-last-charged"></span> <time id="batterycard-battery-last-charged-timeago" class="timeago timeago-contextual"></time><br> class="locale-number locale-number-generic"></span><br>
<strong>{{ $__t('Last charged') }}:</strong> <span id="batterycard-battery-last-charged"></span> <time id="batterycard-battery-last-charged-timeago"
class="timeago timeago-contextual"></time><br>
</div> </div>
</div> </div>

View File

@@ -1,5 +1,5 @@
@push('componentScripts') @push('componentScripts')
<script src="{{ $U('/viewjs/components/calendarcard.js', true) }}?v={{ $version }}"></script> <script src="{{ $U('/viewjs/components/calendarcard.js', true) }}?v={{ $version }}"></script>
@endpush @endpush
<div class="card"> <div class="card">
@@ -7,6 +7,7 @@
<i class="fas fa-calendar"></i> {{ $__t('Calendar') }} <i class="fas fa-calendar"></i> {{ $__t('Calendar') }}
</div> </div>
<div class="card-body"> <div class="card-body">
<div id="calendar" data-target-input="nearest"></div> <div id="calendar"
data-target-input="nearest"></div>
</div> </div>
</div> </div>

View File

@@ -1,21 +1,31 @@
@push('componentScripts') @push('componentScripts')
<script src="{{ $U('/viewjs/components/chorecard.js', true) }}?v={{ $version }}"></script> <script src="{{ $U('/viewjs/components/chorecard.js', true) }}?v={{ $version }}"></script>
@endpush @endpush
<div class="card chorecard"> <div class="card chorecard">
<div class="card-header"> <div class="card-header">
<i class="fas fa-home"></i> {{ $__t('Chore overview') }} <i class="fas fa-home"></i> {{ $__t('Chore overview') }}
<a id="chorecard-chore-edit-button" class="btn btn-sm btn-outline-info py-0 float-right disabled" href="#" data-toggle="tooltip" title="{{ $__t('Edit chore') }}"> <a id="chorecard-chore-edit-button"
class="btn btn-sm btn-outline-info py-0 float-right disabled"
href="#"
data-toggle="tooltip"
title="{{ $__t('Edit chore') }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a id="chorecard-chore-journal-button" class="btn btn-sm btn-outline-secondary py-0 mr-2 float-right disabled show-as-dialog-link" href="#" data-toggle="tooltip" title="{{ $__t('Journal for this chore') }}"> <a id="chorecard-chore-journal-button"
class="btn btn-sm btn-outline-secondary py-0 mr-2 float-right disabled show-as-dialog-link"
href="#"
data-toggle="tooltip"
title="{{ $__t('Journal for this chore') }}">
<i class="fas fa-file-alt"></i> <i class="fas fa-file-alt"></i>
</a> </a>
</div> </div>
<div class="card-body"> <div class="card-body">
<h3><span id="chorecard-chore-name"></span></h3> <h3><span id="chorecard-chore-name"></span></h3>
<strong>{{ $__t('Tracked count') }}:</strong> <span id="chorecard-chore-tracked-count" class="locale-number locale-number-generic"></span><br> <strong>{{ $__t('Tracked count') }}:</strong> <span id="chorecard-chore-tracked-count"
<strong>{{ $__t('Last tracked') }}:</strong> <span id="chorecard-chore-last-tracked"></span> <time id="chorecard-chore-last-tracked-timeago" class="timeago timeago-contextual"></time><br> class="locale-number locale-number-generic"></span><br>
<strong>{{ $__t('Last tracked') }}:</strong> <span id="chorecard-chore-last-tracked"></span> <time id="chorecard-chore-last-tracked-timeago"
class="timeago timeago-contextual"></time><br>
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS) @if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
<strong>{{ $__t('Last done by') }}:</strong> <span id="chorecard-chore-last-done-by"></span> <strong>{{ $__t('Last done by') }}:</strong> <span id="chorecard-chore-last-done-by"></span>
@endif @endif

View File

@@ -1,5 +1,5 @@
@push('componentScripts') @push('componentScripts')
<script src="{{ $U('/viewjs/components/datetimepicker.js', true) }}?v={{ $version }}"></script> <script src="{{ $U('/viewjs/components/datetimepicker.js', true) }}?v={{ $version }}"></script>
@endpush @endpush
@php if(!isset($isRequired)) { $isRequired = true; } @endphp @php if(!isset($isRequired)) { $isRequired = true; } @endphp
@@ -16,33 +16,60 @@
@php if(empty($additionalGroupCssClasses)) { $additionalGroupCssClasses = ''; } @endphp @php if(empty($additionalGroupCssClasses)) { $additionalGroupCssClasses = ''; } @endphp
@php if(empty($activateNumberPad)) { $activateNumberPad = false; } @endphp @php if(empty($activateNumberPad)) { $activateNumberPad = false; } @endphp
<div id="datetimepicker-wrapper" class="form-group {{ $additionalGroupCssClasses }}"> <div id="datetimepicker-wrapper"
class="form-group {{ $additionalGroupCssClasses }}">
<label for="{{ $id }}">{{ $__t($label) }} <label for="{{ $id }}">{{ $__t($label) }}
<span class="small text-muted"> <span class="small text-muted">
@if(!empty($hint)){{ $__t($hint) }}@endif @if(!empty($hint)){{ $__t($hint) }}@endif
<time id="datetimepicker-timeago" class="timeago timeago-contextual"></time> <time id="datetimepicker-timeago"
class="timeago timeago-contextual"></time>
</span> </span>
</label> </label>
<div class="input-group"> <div class="input-group">
<div class="input-group date datetimepicker @if(!empty($additionalGroupCssClasses)){{ $additionalGroupCssClasses }}@endif" id="{{ $id }}" @if(!$noNameAttribute) name="{{ $id }}" @endif data-target-input="nearest"> <div class="input-group date datetimepicker @if(!empty($additionalGroupCssClasses)){{ $additionalGroupCssClasses }}@endif"
<input {!! $additionalAttributes !!} type="text" @if($activateNumberPad) inputmode="numeric" @endif @if($isRequired) @if($isRequired) required @endif @endif class="form-control datetimepicker-input @if(!empty($additionalCssClasses)){{ $additionalCssClasses }}@endif" id="{{ $id }}"
data-target="#{{ $id }}" data-format="{{ $format }}" @if(!$noNameAttribute)
name="{{ $id }}"
@endif
data-target-input="nearest">
<input {!!
$additionalAttributes
!!}
type="text"
@if($activateNumberPad)
inputmode="numeric"
@endif
@if($isRequired)
@if($isRequired)
required
@endif
@endif
class="form-control datetimepicker-input @if(!empty($additionalCssClasses)){{ $additionalCssClasses }}@endif"
data-target="#{{ $id }}"
data-format="{{ $format }}"
data-init-with-now="{{ BoolToString($initWithNow) }}" data-init-with-now="{{ BoolToString($initWithNow) }}"
data-init-value="{{ $initialValue }}" data-init-value="{{ $initialValue }}"
data-limit-end-to-now="{{ BoolToString($limitEndToNow) }}" data-limit-end-to-now="{{ BoolToString($limitEndToNow) }}"
data-limit-start-to-now="{{ BoolToString($limitStartToNow) }}" data-limit-start-to-now="{{ BoolToString($limitStartToNow) }}"
data-next-input-selector="{{ $nextInputSelector }}" data-next-input-selector="{{ $nextInputSelector }}"
data-earlier-than-limit="{{ $earlierThanInfoLimit }}" /> data-earlier-than-limit="{{ $earlierThanInfoLimit }}" />
<div class="input-group-append" data-target="#{{ $id }}" data-toggle="datetimepicker"> <div class="input-group-append"
data-target="#{{ $id }}"
data-toggle="datetimepicker">
<div class="input-group-text"><i class="fas fa-calendar"></i></div> <div class="input-group-text"><i class="fas fa-calendar"></i></div>
</div> </div>
<div class="invalid-feedback">{{ $invalidFeedback }}</div> <div class="invalid-feedback">{{ $invalidFeedback }}</div>
</div> </div>
<div id="datetimepicker-earlier-than-info" class="form-text text-info font-italic d-none">{{ $earlierThanInfoText }}</div> <div id="datetimepicker-earlier-than-info"
class="form-text text-info font-italic d-none">{{ $earlierThanInfoText }}</div>
@if(isset($shortcutValue) && isset($shortcutLabel)) @if(isset($shortcutValue) && isset($shortcutLabel))
<div class="form-check w-100"> <div class="form-check w-100">
<input class="form-check-input" type="checkbox" id="datetimepicker-shortcut" data-datetimepicker-shortcut-value="{{ $shortcutValue }}"> <input class="form-check-input"
<label class="form-check-label" for="datetimepicker-shortcut">{{ $__t($shortcutLabel) }}</label> type="checkbox"
id="datetimepicker-shortcut"
data-datetimepicker-shortcut-value="{{ $shortcutValue }}">
<label class="form-check-label"
for="datetimepicker-shortcut">{{ $__t($shortcutLabel) }}</label>
</div> </div>
@endif @endif
</div> </div>

View File

@@ -1,5 +1,5 @@
@push('componentScripts') @push('componentScripts')
<script src="{{ $U('/viewjs/components/datetimepicker2.js', true) }}?v={{ $version }}"></script> <script src="{{ $U('/viewjs/components/datetimepicker2.js', true) }}?v={{ $version }}"></script>
@endpush @endpush
@php if(!isset($isRequired)) { $isRequired = true; } @endphp @php if(!isset($isRequired)) { $isRequired = true; } @endphp
@@ -15,33 +15,57 @@
@php if(empty($additionalAttributes)) { $additionalAttributes = ''; } @endphp @php if(empty($additionalAttributes)) { $additionalAttributes = ''; } @endphp
@php if(empty($additionalGroupCssClasses)) { $additionalGroupCssClasses = ''; } @endphp @php if(empty($additionalGroupCssClasses)) { $additionalGroupCssClasses = ''; } @endphp
<div id="datetimepicker2-wrapper" class="form-group {{ $additionalGroupCssClasses }}"> <div id="datetimepicker2-wrapper"
class="form-group {{ $additionalGroupCssClasses }}">
<label for="{{ $id }}">{{ $__t($label) }} <label for="{{ $id }}">{{ $__t($label) }}
<span class="small text-muted"> <span class="small text-muted">
@if(!empty($hint)){{ $__t($hint) }}@endif @if(!empty($hint)){{ $__t($hint) }}@endif
<time id="datetimepicker2-timeago" class="timeago timeago-contextual"></time> <time id="datetimepicker2-timeago"
class="timeago timeago-contextual"></time>
</span> </span>
</label> </label>
<div class="input-group"> <div class="input-group">
<div class="input-group date datetimepicker2 @if(!empty($additionalGroupCssClasses)){{ $additionalGroupCssClasses }}@endif" id="{{ $id }}" @if(!$noNameAttribute) name="{{ $id }}" @endif data-target-input="nearest"> <div class="input-group date datetimepicker2 @if(!empty($additionalGroupCssClasses)){{ $additionalGroupCssClasses }}@endif"
<input {!! $additionalAttributes !!} type="text" @if($isRequired) @if($isRequired) required @endif @endif class="form-control datetimepicker2-input @if(!empty($additionalCssClasses)){{ $additionalCssClasses }}@endif" id="{{ $id }}"
data-target="#{{ $id }}" data-format="{{ $format }}" @if(!$noNameAttribute)
name="{{ $id }}"
@endif
data-target-input="nearest">
<input {!!
$additionalAttributes
!!}
type="text"
@if($isRequired)
@if($isRequired)
required
@endif
@endif
class="form-control datetimepicker2-input @if(!empty($additionalCssClasses)){{ $additionalCssClasses }}@endif"
data-target="#{{ $id }}"
data-format="{{ $format }}"
data-init-with-now="{{ BoolToString($initWithNow) }}" data-init-with-now="{{ BoolToString($initWithNow) }}"
data-init-value="{{ $initialValue }}" data-init-value="{{ $initialValue }}"
data-limit-end-to-now="{{ BoolToString($limitEndToNow) }}" data-limit-end-to-now="{{ BoolToString($limitEndToNow) }}"
data-limit-start-to-now="{{ BoolToString($limitStartToNow) }}" data-limit-start-to-now="{{ BoolToString($limitStartToNow) }}"
data-next-input-selector="{{ $nextInputSelector }}" data-next-input-selector="{{ $nextInputSelector }}"
data-earlier-than-limit="{{ $earlierThanInfoLimit }}" /> data-earlier-than-limit="{{ $earlierThanInfoLimit }}" />
<div class="input-group-append" data-target="#{{ $id }}" data-toggle="datetimepicker"> <div class="input-group-append"
data-target="#{{ $id }}"
data-toggle="datetimepicker">
<div class="input-group-text"><i class="fas fa-calendar"></i></div> <div class="input-group-text"><i class="fas fa-calendar"></i></div>
</div> </div>
<div class="invalid-feedback">{{ $invalidFeedback }}</div> <div class="invalid-feedback">{{ $invalidFeedback }}</div>
</div> </div>
<div id="datetimepicker2-earlier-than-info" class="form-text text-info font-italic d-none">{{ $earlierThanInfoText }}</div> <div id="datetimepicker2-earlier-than-info"
class="form-text text-info font-italic d-none">{{ $earlierThanInfoText }}</div>
@if(isset($shortcutValue) && isset($shortcutLabel)) @if(isset($shortcutValue) && isset($shortcutLabel))
<div class="form-check w-100"> <div class="form-check w-100">
<input class="form-check-input" type="checkbox" id="datetimepicker2-shortcut" data-datetimepicker2-shortcut-value="{{ $shortcutValue }}"> <input class="form-check-input"
<label class="form-check-label" for="datetimepicker2-shortcut">{{ $__t($shortcutLabel) }}</label> type="checkbox"
id="datetimepicker2-shortcut"
data-datetimepicker2-shortcut-value="{{ $shortcutValue }}">
<label class="form-check-label"
for="datetimepicker2-shortcut">{{ $__t($shortcutLabel) }}</label>
</div> </div>
@endif @endif
</div> </div>

View File

@@ -1,5 +1,5 @@
@push('componentScripts') @push('componentScripts')
<script src="{{ $U('/viewjs/components/locationpicker.js', true) }}?v={{ $version }}"></script> <script src="{{ $U('/viewjs/components/locationpicker.js', true) }}?v={{ $version }}"></script>
@endpush @endpush
@php if(empty($prefillByName)) { $prefillByName = ''; } @endphp @php if(empty($prefillByName)) { $prefillByName = ''; } @endphp
@@ -7,12 +7,21 @@
@php if(!isset($isRequired)) { $isRequired = true; } @endphp @php if(!isset($isRequired)) { $isRequired = true; } @endphp
@php if(empty($hint)) { $hint = ''; } @endphp @php if(empty($hint)) { $hint = ''; } @endphp
<div class="form-group" data-next-input-selector="{{ $nextInputSelector }}" data-prefill-by-name="{{ $prefillByName }}" data-prefill-by-id="{{ $prefillById }}"> <div class="form-group"
<label for="location_id">{{ $__t('Location') }}&nbsp;&nbsp;<span id="{{ $hintId }}" class="small text-muted">{{ $hint }}</span></label> data-next-input-selector="{{ $nextInputSelector }}"
<select class="form-control location-combobox" id="location_id" name="location_id" @if($isRequired) required @endif> data-prefill-by-name="{{ $prefillByName }}"
data-prefill-by-id="{{ $prefillById }}">
<label for="location_id">{{ $__t('Location') }}&nbsp;&nbsp;<span id="{{ $hintId }}"
class="small text-muted">{{ $hint }}</span></label>
<select class="form-control location-combobox"
id="location_id"
name="location_id"
@if($isRequired)
required
@endif>
<option value=""></option> <option value=""></option>
@foreach($locations as $location) @foreach($locations as $location)
<option value="{{ $location->id }}">{{ $location->name }}</option> <option value="{{ $location->id }}">{{ $location->name }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('You have to select a location') }}</div> <div class="invalid-feedback">{{ $__t('You have to select a location') }}</div>

View File

@@ -1,5 +1,5 @@
@push('componentScripts') @push('componentScripts')
<script src="{{ $U('/viewjs/components/numberpicker.js', true) }}?v={{ $version }}"></script> <script src="{{ $U('/viewjs/components/numberpicker.js', true) }}?v={{ $version }}"></script>
@endpush @endpush
@php if(!isset($value)) { $value = 1; } @endphp @php if(!isset($value)) { $value = 1; } @endphp
@@ -16,12 +16,30 @@
@php if(!isset($isRequired)) { $isRequired = true; } @endphp @php if(!isset($isRequired)) { $isRequired = true; } @endphp
@php if(!isset($noNameAttribute)) { $noNameAttribute = false; } @endphp @php if(!isset($noNameAttribute)) { $noNameAttribute = false; } @endphp
<div id="group-{{ $id }}" class="form-group {{ $additionalGroupCssClasses }}"> <div id="group-{{ $id }}"
class="form-group {{ $additionalGroupCssClasses }}">
<label for="{{ $id }}"> <label for="{{ $id }}">
{{ $__t($label) }}&nbsp; {{ $__t($label) }}&nbsp;
<span id="{{ $hintId }}" data-toggle="tooltip" title="{{ $hint }}"></span>{!! $additionalHtmlContextHelp !!}</label> <span id="{{ $hintId }}"
data-toggle="tooltip"
title="{{ $hint }}"></span>{!! $additionalHtmlContextHelp !!}</label>
<div class="input-group"> <div class="input-group">
<input {!! $additionalAttributes !!} type="number" class="form-control numberpicker {{ $additionalCssClasses }}" id="{{ $id }}" @if(!$noNameAttribute) name="{{ $id }}" @endif value="{{ $value }}" min="{{ $min }}" max="{{ $max }}" step="{{ $step }}" @if($isRequired) required @endif> <input {!!
$additionalAttributes
!!}
type="number"
class="form-control numberpicker {{ $additionalCssClasses }}"
id="{{ $id }}"
@if(!$noNameAttribute)
name="{{ $id }}"
@endif
value="{{ $value }}"
min="{{ $min }}"
max="{{ $max }}"
step="{{ $step }}"
@if($isRequired)
required
@endif>
<div class="input-group-append"> <div class="input-group-append">
<div class="input-group-text numberpicker-up-button"><i class="fas fa-arrow-up"></i></div> <div class="input-group-text numberpicker-up-button"><i class="fas fa-arrow-up"></i></div>
</div> </div>

View File

@@ -1,5 +1,5 @@
@push('componentScripts') @push('componentScripts')
<script src="{{ $U('/viewjs/components/productamountpicker.js', true) }}?v={{ $version }}"></script> <script src="{{ $U('/viewjs/components/productamountpicker.js', true) }}?v={{ $version }}"></script>
@endpush @endpush
@php if(empty($additionalGroupCssClasses)) { $additionalGroupCssClasses = ''; } @endphp @php if(empty($additionalGroupCssClasses)) { $additionalGroupCssClasses = ''; } @endphp
@@ -9,25 +9,33 @@
<div class="row"> <div class="row">
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'display_amount', 'id' => 'display_amount',
'label' => 'Amount', 'label' => 'Amount',
'min' => 0, 'min' => 0,
'value' => $value, 'value' => $value,
'invalidFeedback' => $__t('This cannot be negative and must be an integral number'), 'invalidFeedback' => $__t('This cannot be negative and must be an integral number'),
'additionalGroupCssClasses' => 'col-4 mb-1', 'additionalGroupCssClasses' => 'col-4 mb-1',
'additionalCssClasses' => 'input-group-productamountpicker' 'additionalCssClasses' => 'input-group-productamountpicker'
)) ))
<div class="form-group col-8 mb-1"> <div class="form-group col-8 mb-1">
<label for="qu_id">{{ $__t('Quantity unit') }}</label> <label for="qu_id">{{ $__t('Quantity unit') }}</label>
<select required class="form-control input-group-productamountpicker" id="qu_id" name="qu_id" data-initial-qu-id="{{ $initialQuId }}"> <select required
class="form-control input-group-productamountpicker"
id="qu_id"
name="qu_id"
data-initial-qu-id="{{ $initialQuId }}">
<option></option> <option></option>
</select> </select>
<div class="invalid-feedback">{{ $__t('A quantity unit is required') }}</div> <div class="invalid-feedback">{{ $__t('A quantity unit is required') }}</div>
</div> </div>
<div id="qu-conversion-info" class="col form-text text-info d-none"></div> <div id="qu-conversion-info"
<input type="hidden" id="amount" name="amount" value=""> class="col form-text text-info d-none"></div>
<input type="hidden"
id="amount"
name="amount"
value="">
</div> </div>
</div> </div>

View File

@@ -1,45 +1,70 @@
@push('componentScripts') @push('componentScripts')
<script src="{{ $U('/node_modules/chart.js/dist/Chart.min.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/node_modules/chart.js/dist/Chart.min.js?v=', true) }}{{ $version }}"></script>
<script src="{{ $U('/viewjs/components/productcard.js', true) }}?v={{ $version }}"></script> <script src="{{ $U('/viewjs/components/productcard.js', true) }}?v={{ $version }}"></script>
@endpush @endpush
<div class="card productcard"> <div class="card productcard">
<div class="card-header"> <div class="card-header">
<i class="fab fa-product-hunt"></i> {{ $__t('Product overview') }} <i class="fab fa-product-hunt"></i> {{ $__t('Product overview') }}
<a id="productcard-product-edit-button" class="btn btn-sm btn-outline-info py-0 float-right disabled" href="#" data-toggle="tooltip" title="{{ $__t('Edit product') }}"> <a id="productcard-product-edit-button"
class="btn btn-sm btn-outline-info py-0 float-right disabled"
href="#"
data-toggle="tooltip"
title="{{ $__t('Edit product') }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a id="productcard-product-journal-button" class="btn btn-sm btn-outline-secondary py-0 mr-2 float-right disabled show-as-dialog-link" href="#" data-toggle="tooltip" title="{{ $__t('Stock journal for this product') }}"> <a id="productcard-product-journal-button"
class="btn btn-sm btn-outline-secondary py-0 mr-2 float-right disabled show-as-dialog-link"
href="#"
data-toggle="tooltip"
title="{{ $__t('Stock journal for this product') }}">
<i class="fas fa-file-alt"></i> <i class="fas fa-file-alt"></i>
</a> </a>
</div> </div>
<div class="card-body"> <div class="card-body">
<h3><span id="productcard-product-name"></span></h3> <h3><span id="productcard-product-name"></span></h3>
<div id="productcard-product-description-wrapper" class="expandable-text mb-2 d-none"> <div id="productcard-product-description-wrapper"
<p id="productcard-product-description" class="text-muted collapse mb-0"></p> class="expandable-text mb-2 d-none">
<a class="collapsed" data-toggle="collapse" href="#productcard-product-description">{{ $__t('Show more') }}</a> <p id="productcard-product-description"
class="text-muted collapse mb-0"></p>
<a class="collapsed"
data-toggle="collapse"
href="#productcard-product-description">{{ $__t('Show more') }}</a>
</div> </div>
<strong>{{ $__t('Stock amount') }}:</strong> <span id="productcard-product-stock-amount" class="locale-number locale-number-quantity-amount"></span> <span id="productcard-product-stock-qu-name"></span> <strong>{{ $__t('Stock amount') }}:</strong> <span id="productcard-product-stock-amount"
<span id="productcard-product-stock-factor-purchase-amount" class="locale-number locale-number-quantity-amount"></span> <span id="productcard-product-stock-factor-purchase-qu-name"></span> class="locale-number locale-number-quantity-amount"></span> <span id="productcard-product-stock-qu-name"></span>
<span id="productcard-product-stock-opened-amount" class="small font-italic locale-number locale-number-quantity-amount"></span><br> <span id="productcard-product-stock-factor-purchase-amount"
<strong>{{ $__t('Stock value') }}:</strong> <span id="productcard-product-stock-value" class="locale-number locale-number-currency"></span> class="locale-number locale-number-quantity-amount"></span> <span id="productcard-product-stock-factor-purchase-qu-name"></span>
<span id="productcard-aggregated-amounts" class="pl-2 text-secondary d-none"><i class="fas fa-custom-sigma-sign"></i> <span id="productcard-product-stock-amount-aggregated" class="locale-number locale-number-quantity-amount"></span> <span id="productcard-product-stock-qu-name-aggregated"></span> <span id="productcard-product-stock-opened-amount-aggregated locale-number locale-number-quantity-amount" class="small font-italic"></span></span><br> <span id="productcard-product-stock-opened-amount"
class="small font-italic locale-number locale-number-quantity-amount"></span><br>
<strong>{{ $__t('Stock value') }}:</strong> <span id="productcard-product-stock-value"
class="locale-number locale-number-currency"></span>
<span id="productcard-aggregated-amounts"
class="pl-2 text-secondary d-none"><i class="fas fa-custom-sigma-sign"></i> <span id="productcard-product-stock-amount-aggregated"
class="locale-number locale-number-quantity-amount"></span> <span id="productcard-product-stock-qu-name-aggregated"></span> <span id="productcard-product-stock-opened-amount-aggregated locale-number locale-number-quantity-amount"
class="small font-italic"></span></span><br>
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)<strong>{{ $__t('Default location') }}:</strong> <span id="productcard-product-location"></span><br>@endif @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)<strong>{{ $__t('Default location') }}:</strong> <span id="productcard-product-location"></span><br>@endif
<strong>{{ $__t('Last purchased') }}:</strong> <span id="productcard-product-last-purchased"></span> <time id="productcard-product-last-purchased-timeago" class="timeago timeago-contextual"></time><br> <strong>{{ $__t('Last purchased') }}:</strong> <span id="productcard-product-last-purchased"></span> <time id="productcard-product-last-purchased-timeago"
<strong>{{ $__t('Last used') }}:</strong> <span id="productcard-product-last-used"></span> <time id="productcard-product-last-used-timeago" class="timeago timeago-contextual"></time><br> class="timeago timeago-contextual"></time><br>
<strong>{{ $__t('Last used') }}:</strong> <span id="productcard-product-last-used"></span> <time id="productcard-product-last-used-timeago"
class="timeago timeago-contextual"></time><br>
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)<strong>{{ $__t('Last price') }}:</strong> <span id="productcard-product-last-price"></span><br>@endif @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)<strong>{{ $__t('Last price') }}:</strong> <span id="productcard-product-last-price"></span><br>@endif
@if (GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)<strong>{{ $__t('Average price') }}:</strong> <span id="productcard-product-average-price"></span><br>@endif @if (GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)<strong>{{ $__t('Average price') }}:</strong> <span id="productcard-product-average-price"></span><br>@endif
@if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)<strong>{{ $__t('Average shelf life') }}:</strong> <span id="productcard-product-average-shelf-life"></span><br>@endif @if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)<strong>{{ $__t('Average shelf life') }}:</strong> <span id="productcard-product-average-shelf-life"></span><br>@endif
<strong>{{ $__t('Spoil rate') }}:</strong> <span id="productcard-product-spoil-rate"></span> <strong>{{ $__t('Spoil rate') }}:</strong> <span id="productcard-product-spoil-rate"></span>
<p class="w-75 mt-3 mx-auto"><img id="productcard-product-picture" data-src="" class="img-fluid img-thumbnail d-none lazy"></p> <p class="w-75 mt-3 mx-auto"><img id="productcard-product-picture"
data-src=""
class="img-fluid img-thumbnail d-none lazy"></p>
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
<h5 class="mt-3">{{ $__t('Price history') }}</h5> <h5 class="mt-3">{{ $__t('Price history') }}</h5>
<canvas id="productcard-product-price-history-chart" class="w-100 d-none"></canvas> <canvas id="productcard-product-price-history-chart"
<span id="productcard-no-price-data-hint" class="font-italic d-none">{{ $__t('No price history available') }}</span> class="w-100 d-none"></canvas>
<span id="productcard-no-price-data-hint"
class="font-italic d-none">{{ $__t('No price history available') }}</span>
@endif @endif
</div> </div>
</div> </div>

View File

@@ -1,5 +1,5 @@
@push('componentScripts') @push('componentScripts')
<script src="{{ $U('/viewjs/components/productpicker.js', true) }}?v={{ $version }}"></script> <script src="{{ $U('/viewjs/components/productpicker.js', true) }}?v={{ $version }}"></script>
@endpush @endpush
@php if(empty($disallowAddProductWorkflows)) { $disallowAddProductWorkflows = false; } @endphp @php if(empty($disallowAddProductWorkflows)) { $disallowAddProductWorkflows = false; } @endphp
@@ -12,23 +12,41 @@
@php if(empty($hint)) { $hint = ''; } @endphp @php if(empty($hint)) { $hint = ''; } @endphp
@php if(empty($nextInputSelector)) { $nextInputSelector = ''; } @endphp @php if(empty($nextInputSelector)) { $nextInputSelector = ''; } @endphp
<div class="form-group" data-next-input-selector="{{ $nextInputSelector }}" data-disallow-add-product-workflows="{{ BoolToString($disallowAddProductWorkflows) }}" data-disallow-all-product-workflows="{{ BoolToString($disallowAllProductWorkflows) }}" data-prefill-by-name="{{ $prefillByName }}" data-prefill-by-id="{{ $prefillById }}"> <div class="form-group"
data-next-input-selector="{{ $nextInputSelector }}"
data-disallow-add-product-workflows="{{ BoolToString($disallowAddProductWorkflows) }}"
data-disallow-all-product-workflows="{{ BoolToString($disallowAllProductWorkflows) }}"
data-prefill-by-name="{{ $prefillByName }}"
data-prefill-by-id="{{ $prefillById }}">
<label for="product_id"> <label for="product_id">
{{ $__t($label) }}&nbsp;<i class="fas fa-barcode"></i>&nbsp; {{ $__t($label) }}&nbsp;<i class="fas fa-barcode"></i>&nbsp;
<span id="barcode-lookup-disabled-hint" class="small text-muted d-none"> {{ $__t('Barcode lookup is disabled') }}</span>&nbsp; <span id="barcode-lookup-disabled-hint"
class="small text-muted d-none"> {{ $__t('Barcode lookup is disabled') }}</span>&nbsp;
</label> </label>
<select class="form-control product-combobox barcodescanner-input" id="product_id" name="product_id" @if($isRequired) required @endif @if($disabled) disabled @endif data-target="@productpicker"> <select class="form-control product-combobox barcodescanner-input"
id="product_id"
name="product_id"
@if($isRequired)
required
@endif
@if($disabled)
disabled
@endif
data-target="@productpicker">
<option value=""></option> <option value=""></option>
@foreach($products as $product) @foreach($products as $product)
<option data-additional-searchdata="{{ FindObjectInArrayByPropertyValue($barcodes, 'product_id', $product->id)->barcodes }}," value="{{ $product->id }}">{{ $product->name }}</option> <option data-additional-searchdata="{{ FindObjectInArrayByPropertyValue($barcodes, 'product_id', $product->id)->barcodes }},"
value="{{ $product->id }}">{{ $product->name }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('You have to select a product') }}</div> <div class="invalid-feedback">{{ $__t('You have to select a product') }}</div>
<div id="custom-productpicker-error" class="form-text text-danger d-none"></div> <div id="custom-productpicker-error"
class="form-text text-danger d-none"></div>
@if(!$disallowAllProductWorkflows) @if(!$disallowAllProductWorkflows)
<div class="form-text text-info small">{{ $__t('Type a new product name or barcode and hit TAB to start a workflow') }}</div> <div class="form-text text-info small">{{ $__t('Type a new product name or barcode and hit TAB to start a workflow') }}</div>
@endif @endif
<div id="flow-info-addbarcodetoselection" class="form-text text-muted small d-none"><strong><span id="addbarcodetoselection"></span></strong> {{ $__t('will be added to the list of barcodes for the selected product on submit') }}</div> <div id="flow-info-addbarcodetoselection"
class="form-text text-muted small d-none"><strong><span id="addbarcodetoselection"></span></strong> {{ $__t('will be added to the list of barcodes for the selected product on submit') }}</div>
</div> </div>
@include('components.barcodescanner') @include('components.barcodescanner')

View File

@@ -1,5 +1,5 @@
@push('componentScripts') @push('componentScripts')
<script src="{{ $U('/viewjs/components/recipepicker.js', true) }}?v={{ $version }}"></script> <script src="{{ $U('/viewjs/components/recipepicker.js', true) }}?v={{ $version }}"></script>
@endpush @endpush
@php if(empty($prefillByName)) { $prefillByName = ''; } @endphp @php if(empty($prefillByName)) { $prefillByName = ''; } @endphp
@@ -9,12 +9,21 @@
@php if(empty($hintId)) { $hintId = ''; } @endphp @php if(empty($hintId)) { $hintId = ''; } @endphp
@php if(empty($nextInputSelector)) { $nextInputSelector = ''; } @endphp @php if(empty($nextInputSelector)) { $nextInputSelector = ''; } @endphp
<div class="form-group" data-next-input-selector="{{ $nextInputSelector }}" data-prefill-by-name="{{ $prefillByName }}" data-prefill-by-id="{{ $prefillById }}"> <div class="form-group"
<label for="recipe_id">{{ $__t('Recipe') }}&nbsp;&nbsp;<span id="{{ $hintId }}" class="small text-muted">{{ $hint }}</span></label> data-next-input-selector="{{ $nextInputSelector }}"
<select class="form-control recipe-combobox" id="recipe_id" name="recipe_id" @if($isRequired) required @endif> data-prefill-by-name="{{ $prefillByName }}"
data-prefill-by-id="{{ $prefillById }}">
<label for="recipe_id">{{ $__t('Recipe') }}&nbsp;&nbsp;<span id="{{ $hintId }}"
class="small text-muted">{{ $hint }}</span></label>
<select class="form-control recipe-combobox"
id="recipe_id"
name="recipe_id"
@if($isRequired)
required
@endif>
<option value=""></option> <option value=""></option>
@foreach($recipes as $recipe) @foreach($recipes as $recipe)
<option value="{{ $recipe->id }}">{{ $recipe->name }}</option> <option value="{{ $recipe->id }}">{{ $recipe->name }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('You have to select a recipe') }}</div> <div class="invalid-feedback">{{ $__t('You have to select a recipe') }}</div>

View File

@@ -1,5 +1,5 @@
@push('componentScripts') @push('componentScripts')
<script src="{{ $U('/viewjs/components/shoppinglocationpicker.js', true) }}?v={{ $version }}"></script> <script src="{{ $U('/viewjs/components/shoppinglocationpicker.js', true) }}?v={{ $version }}"></script>
@endpush @endpush
@php if(empty($prefillByName)) { $prefillByName = ''; } @endphp @php if(empty($prefillByName)) { $prefillByName = ''; } @endphp
@@ -8,13 +8,22 @@
@php if(empty($hint)) { $hint = ''; } @endphp @php if(empty($hint)) { $hint = ''; } @endphp
@php if(empty($nextInputSelector)) { $nextInputSelector = ''; } @endphp @php if(empty($nextInputSelector)) { $nextInputSelector = ''; } @endphp
<div class="form-group" data-next-input-selector="{{ $nextInputSelector }}" data-prefill-by-name="{{ $prefillByName }}" data-prefill-by-id="{{ $prefillById }}"> <div class="form-group"
<label for="shopping_location_id">{{ $__t($label) }}&nbsp;&nbsp;<span id="{{ $hintId }}" class="small text-muted">{{ $hint }}</span></label> data-next-input-selector="{{ $nextInputSelector }}"
<select class="form-control shopping-location-combobox" id="shopping_location_id" name="shopping_location_id" @if($isRequired) required @endif> data-prefill-by-name="{{ $prefillByName }}"
data-prefill-by-id="{{ $prefillById }}">
<label for="shopping_location_id">{{ $__t($label) }}&nbsp;&nbsp;<span id="{{ $hintId }}"
class="small text-muted">{{ $hint }}</span></label>
<select class="form-control shopping-location-combobox"
id="shopping_location_id"
name="shopping_location_id"
@if($isRequired)
required
@endif>
<option value=""></option> <option value=""></option>
@foreach($shoppinglocations as $shoppinglocation) @foreach($shoppinglocations as $shoppinglocation)
<option value="{{ $shoppinglocation->id }}">{{ $shoppinglocation->name }}</option> <option value="{{ $shoppinglocation->id }}">{{ $shoppinglocation->name }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('You have to select a store') }}</div> <div class="invalid-feedback">{{ $__t('You have to select a store') }}</div>
</div> </div>

View File

@@ -3,27 +3,33 @@
@foreach($userfields as $userfield) @foreach($userfields as $userfield)
@if($userfield->show_as_column_in_tables == 1) @if($userfield->show_as_column_in_tables == 1)
@php $userfieldObject = FindObjectInArrayByPropertyValue($userfieldValues, 'name', $userfield->name) @endphp @php $userfieldObject = FindObjectInArrayByPropertyValue($userfieldValues, 'name', $userfield->name) @endphp
<td> <td>
@if($userfieldObject !== null) @if($userfieldObject !== null)
@if($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_CHECKBOX) @if($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_CHECKBOX)
@if($userfieldObject->value == 1)<i class="fas fa-check"></i>@endif @if($userfieldObject->value == 1)<i class="fas fa-check"></i>@endif
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_PRESET_CHECKLIST) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_PRESET_CHECKLIST)
{!! str_replace(',', '<br>', $userfieldObject->value) !!} {!! str_replace(',', '<br>', $userfieldObject->value) !!}
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_LINK) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_LINK)
<a href="{{ $userfieldObject->value }}" target="_blank">{{ $userfieldObject->value }}</a> <a href="{{ $userfieldObject->value }}"
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_FILE) target="_blank">{{ $userfieldObject->value }}</a>
<a class="show-as-dialog-link" href="{{ $U('/files/userfiles/'. $userfieldObject->value) }}" target="_blank">{{ base64_decode(explode('_', $userfieldObject->value)[1]) }}</a> @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_FILE)
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_IMAGE) <a class="show-as-dialog-link"
<a class="show-as-dialog-link" href="{{ $U('/files/userfiles/'. $userfieldObject->value . '?force_serve_as=picture') }}"> href="{{ $U('/files/userfiles/'. $userfieldObject->value) }}"
<img src="{{ $U('/files/userfiles/'. $userfieldObject->value . '?force_serve_as=picture&best_fit_width=32&best_fit_height=32') }}" target="_blank">{{ base64_decode(explode('_', $userfieldObject->value)[1]) }}</a>
class="lazy" title="{{ base64_decode(explode('_', $userfieldObject->value)[1]) }}" alt="{{ base64_decode(explode('_', $userfieldObject->value)[1]) }}"> @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_IMAGE)
</a> <a class="show-as-dialog-link"
@else href="{{ $U('/files/userfiles/'. $userfieldObject->value . '?force_serve_as=picture') }}">
{{ $userfieldObject->value }} <img src="{{ $U('/files/userfiles/'. $userfieldObject->value . '?force_serve_as=picture&best_fit_width=32&best_fit_height=32') }}"
@endif class="lazy"
title="{{ base64_decode(explode('_', $userfieldObject->value)[1]) }}"
alt="{{ base64_decode(explode('_', $userfieldObject->value)[1]) }}">
</a>
@else
{{ $userfieldObject->value }}
@endif @endif
</td> @endif
</td>
@endif @endif
@endforeach @endforeach

View File

@@ -3,7 +3,7 @@
@foreach($userfields as $userfield) @foreach($userfields as $userfield)
@if($userfield->show_as_column_in_tables == 1) @if($userfield->show_as_column_in_tables == 1)
<th>{{ $userfield->caption }}</th> <th>{{ $userfield->caption }}</th>
@endif @endif
@endforeach @endforeach

View File

@@ -1,10 +1,13 @@
@push('componentScripts') @push('componentScripts')
<script src="{{ $U('/viewjs/components/userfieldsform.js', true) }}?v={{ $version }}"></script> <script src="{{ $U('/viewjs/components/userfieldsform.js', true) }}?v={{ $version }}"></script>
@endpush @endpush
@if(count($userfields) > 0) @if(count($userfields) > 0)
<div id="userfields-form" data-entity="{{ $entity }}" class="border border-info p-2 mb-2" novalidate> <div id="userfields-form"
data-entity="{{ $entity }}"
class="border border-info p-2 mb-2"
novalidate>
<h2 class="small">{{ $__t('Userfields') }}</h2> <h2 class="small">{{ $__t('Userfields') }}</h2>
@foreach($userfields as $userfield) @foreach($userfields as $userfield)
@@ -12,114 +15,142 @@
@if($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_SINGLE_LINE_TEXT) @if($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_SINGLE_LINE_TEXT)
<div class="form-group"> <div class="form-group">
<label for="name">{{ $userfield->caption }}</label> <label for="name">{{ $userfield->caption }}</label>
<input type="text" class="form-control userfield-input" data-userfield-name="{{ $userfield->name }}"> <input type="text"
class="form-control userfield-input"
data-userfield-name="{{ $userfield->name }}">
</div> </div>
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_SINGLE_MULTILINE_TEXT) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_SINGLE_MULTILINE_TEXT)
<div class="form-group"> <div class="form-group">
<label for="description">{{ $userfield->caption }}</label> <label for="description">{{ $userfield->caption }}</label>
<textarea class="form-control userfield-input" rows="4" data-userfield-name="{{ $userfield->name }}"></textarea> <textarea class="form-control userfield-input"
rows="4"
data-userfield-name="{{ $userfield->name }}"></textarea>
</div> </div>
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_INTEGRAL_NUMBER) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_INTEGRAL_NUMBER)
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => $userfield->name, 'id' => $userfield->name,
'label' => $userfield->caption, 'label' => $userfield->caption,
'noNameAttribute' => true, 'noNameAttribute' => true,
'min' => 0, 'min' => 0,
'isRequired' => false, 'isRequired' => false,
'additionalCssClasses' => 'userfield-input', 'additionalCssClasses' => 'userfield-input',
'additionalAttributes' => 'data-userfield-name="' . $userfield->name . '"' 'additionalAttributes' => 'data-userfield-name="' . $userfield->name . '"'
)) ))
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_DECIMAL_NUMBER) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_DECIMAL_NUMBER)
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => '', 'id' => '',
'label' => $userfield->caption, 'label' => $userfield->caption,
'noNameAttribute' => true, 'noNameAttribute' => true,
'min' => 0, 'min' => 0,
'step' => 0.01, 'step' => 0.01,
'isRequired' => false, 'isRequired' => false,
'additionalCssClasses' => 'userfield-input', 'additionalCssClasses' => 'userfield-input',
'additionalAttributes' => 'data-userfield-name="' . $userfield->name . '"' 'additionalAttributes' => 'data-userfield-name="' . $userfield->name . '"'
)) ))
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_DATE) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_DATE)
@include('components.datetimepicker', array( @include('components.datetimepicker', array(
'id' => $userfield->name, 'id' => $userfield->name,
'label' => $userfield->caption, 'label' => $userfield->caption,
'noNameAttribute' => true, 'noNameAttribute' => true,
'format' => 'YYYY-MM-DD', 'format' => 'YYYY-MM-DD',
'initWithNow' => false, 'initWithNow' => false,
'limitEndToNow' => false, 'limitEndToNow' => false,
'limitStartToNow' => false, 'limitStartToNow' => false,
'additionalGroupCssClasses' => 'date-only-datetimepicker', 'additionalGroupCssClasses' => 'date-only-datetimepicker',
'isRequired' => false, 'isRequired' => false,
'additionalCssClasses' => 'userfield-input', 'additionalCssClasses' => 'userfield-input',
'additionalAttributes' => 'data-userfield-name="' . $userfield->name . '"' 'additionalAttributes' => 'data-userfield-name="' . $userfield->name . '"'
)) ))
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_DATETIME) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_DATETIME)
@include('components.datetimepicker', array( @include('components.datetimepicker', array(
'id' => $userfield->name, 'id' => $userfield->name,
'label' => $userfield->caption, 'label' => $userfield->caption,
'noNameAttribute' => true, 'noNameAttribute' => true,
'format' => 'YYYY-MM-DD HH:mm:ss', 'format' => 'YYYY-MM-DD HH:mm:ss',
'initWithNow' => false, 'initWithNow' => false,
'limitEndToNow' => false, 'limitEndToNow' => false,
'limitStartToNow' => false, 'limitStartToNow' => false,
'isRequired' => false, 'isRequired' => false,
'additionalCssClasses' => 'userfield-input', 'additionalCssClasses' => 'userfield-input',
'additionalAttributes' => 'data-userfield-name="' . $userfield->name . '"' 'additionalAttributes' => 'data-userfield-name="' . $userfield->name . '"'
)) ))
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_CHECKBOX) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_CHECKBOX)
<div class="form-group"> <div class="form-group">
<div class="form-check"> <div class="form-check">
<input class="form-check-input userfield-input" type="checkbox" data-userfield-name="{{ $userfield->name }}" value="1"> <input class="form-check-input userfield-input"
<label class="form-check-label" for="{{ $userfield->name }}">{{ $userfield->caption }}</label> type="checkbox"
data-userfield-name="{{ $userfield->name }}"
value="1">
<label class="form-check-label"
for="{{ $userfield->name }}">{{ $userfield->caption }}</label>
</div> </div>
</div> </div>
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_PRESET_LIST) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_PRESET_LIST)
<div class="form-group"> <div class="form-group">
<label for="{{ $userfield->name }}">{{ $userfield->caption }}</label> <label for="{{ $userfield->name }}">{{ $userfield->caption }}</label>
<select class="form-control userfield-input" data-userfield-name="{{ $userfield->name }}"> <select class="form-control userfield-input"
data-userfield-name="{{ $userfield->name }}">
<option></option> <option></option>
@foreach(preg_split('/\r\n|\r|\n/', $userfield->config) as $option) @foreach(preg_split('/\r\n|\r|\n/', $userfield->config) as $option)
<option value="{{ $option }}">{{ $option }}</option> <option value="{{ $option }}">{{ $option }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_PRESET_CHECKLIST) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_PRESET_CHECKLIST)
<div class="form-group"> <div class="form-group">
<label for="{{ $userfield->name }}">{{ $userfield->caption }}</label> <label for="{{ $userfield->name }}">{{ $userfield->caption }}</label>
<select multiple class="form-control userfield-input selectpicker" data-userfield-name="{{ $userfield->name }}" data-actions-Box="true" data-live-search="true"> <select multiple
class="form-control userfield-input selectpicker"
data-userfield-name="{{ $userfield->name }}"
data-actions-Box="true"
data-live-search="true">
@foreach(preg_split('/\r\n|\r|\n/', $userfield->config) as $option) @foreach(preg_split('/\r\n|\r|\n/', $userfield->config) as $option)
<option value="{{ $option }}">{{ $option }}</option> <option value="{{ $option }}">{{ $option }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_LINK) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_LINK)
<div class="form-group"> <div class="form-group">
<label for="name">{{ $userfield->caption }}</label> <label for="name">{{ $userfield->caption }}</label>
<input type="link" class="form-control userfield-input" data-userfield-name="{{ $userfield->name }}"> <input type="link"
class="form-control userfield-input"
data-userfield-name="{{ $userfield->name }}">
</div> </div>
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_FILE) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_FILE)
<div class="form-group"> <div class="form-group">
<label for="{{ $userfield->name }}">{{ $userfield->caption }}</label> <label for="{{ $userfield->name }}">{{ $userfield->caption }}</label>
<input type="file" class="form-control userfield-input" data-userfield-name="{{ $userfield->name }}"> <input type="file"
<div class="d-none userfield-file"> class="form-control userfield-input"
<a href="" class="userfield-current-file" data-uf-name="{{ $userfield->name }}"></a> data-userfield-name="{{ $userfield->name }}">
<button type="button" class="userfield-current-file btn btn-danger userfield-file-delete" data-uf-name="{{ $userfield->name }}"> <div class="d-none userfield-file">
<i class="fas fa-trash"></i> <a href=""
</button> class="userfield-current-file"
</div> data-uf-name="{{ $userfield->name }}"></a>
<button type="button"
class="userfield-current-file btn btn-danger userfield-file-delete"
data-uf-name="{{ $userfield->name }}">
<i class="fas fa-trash"></i>
</button>
</div> </div>
</div>
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_IMAGE) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_IMAGE)
<div class="form-group"> <div class="form-group">
<label for="{{ $userfield->name }}">{{ $userfield->caption }}</label> <label for="{{ $userfield->name }}">{{ $userfield->caption }}</label>
<input type="file" class="form-control userfield-input" data-userfield-name="{{ $userfield->name }}"> <input type="file"
<div class="d-none userfield-file"> class="form-control userfield-input"
<img src="" alt="{{ $userfield->name }}" class="userfield-current-file" data-uf-name="{{ $userfield->name }}"/> data-userfield-name="{{ $userfield->name }}">
<button type="button" class="userfield-current-file btn btn-danger userfield-file-delete" data-uf-name="{{ $userfield->name }}"> <div class="d-none userfield-file">
<i class="fas fa-trash"></i> <img src=""
</button> alt="{{ $userfield->name }}"
</div> class="userfield-current-file"
data-uf-name="{{ $userfield->name }}" />
<button type="button"
class="userfield-current-file btn btn-danger userfield-file-delete"
data-uf-name="{{ $userfield->name }}">
<i class="fas fa-trash"></i>
</button>
</div> </div>
</div>
@endif @endif
@endforeach @endforeach

View File

@@ -1,15 +1,19 @@
<label> <label>
<input type="checkbox" name="{{ $perm->permission_name }}" class="permission-cb" data-perm-id="{{ $perm->permission_id }}" @if($perm->has_permission) checked @endif autocomplete="off"> <input type="checkbox"
name="{{ $perm->permission_name }}"
class="permission-cb"
data-perm-id="{{ $perm->permission_id }}"
@if($perm->has_permission) checked @endif autocomplete="off">
{{ $__t($perm->permission_name) }} {{ $__t($perm->permission_name) }}
</label> </label>
<div id="permission-sub-{{ $perm->permission_name }}"> <div id="permission-sub-{{ $perm->permission_name }}">
<ul> <ul>
@foreach($perm->uihelper_user_permissionsList(array('user_id' => $user->id))->via('parent') as $p) @foreach($perm->uihelper_user_permissionsList(array('user_id' => $user->id))->via('parent') as $p)
<li> <li>
@include('components.userpermission_select', array( @include('components.userpermission_select', array(
'perm' => $p 'perm' => $p
)) ))
</li> </li>
@endforeach @endforeach
</ul> </ul>
</div> </div>

View File

@@ -1,17 +1,23 @@
@push('componentScripts') @push('componentScripts')
<script src="{{ $U('/viewjs/components/userpicker.js', true) }}?v={{ $version }}"></script> <script src="{{ $U('/viewjs/components/userpicker.js', true) }}?v={{ $version }}"></script>
@endpush @endpush
@php if(empty($prefillByUsername)) { $prefillByUsername = ''; } @endphp @php if(empty($prefillByUsername)) { $prefillByUsername = ''; } @endphp
@php if(empty($prefillByUserId)) { $prefillByUserId = ''; } @endphp @php if(empty($prefillByUserId)) { $prefillByUserId = ''; } @endphp
@php if(!isset($nextInputSelector)) { $nextInputSelector = ''; } @endphp @php if(!isset($nextInputSelector)) { $nextInputSelector = ''; } @endphp
<div class="form-group" data-next-input-selector="{{ $nextInputSelector }}" data-prefill-by-username="{{ $prefillByUsername }}" data-prefill-by-user-id="{{ $prefillByUserId }}"> <div class="form-group"
data-next-input-selector="{{ $nextInputSelector }}"
data-prefill-by-username="{{ $prefillByUsername }}"
data-prefill-by-user-id="{{ $prefillByUserId }}">
<label for="user_id">{{ $__t($label) }}</label> <label for="user_id">{{ $__t($label) }}</label>
<select class="form-control user-combobox" id="user_id" name="user_id"> <select class="form-control user-combobox"
id="user_id"
name="user_id">
<option value=""></option> <option value=""></option>
@foreach($users as $user) @foreach($users as $user)
<option data-additional-searchdata="{{ $user->username }}" value="{{ $user->id }}">{{ GetUserDisplayName($user) }}</option> <option data-additional-searchdata="{{ $user->username }}"
value="{{ $user->id }}">{{ GetUserDisplayName($user) }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>

View File

@@ -5,7 +5,7 @@
@section('viewJsName', 'consume') @section('viewJsName', 'consume')
@push('pageScripts') @push('pageScripts')
<script src="{{ $U('/js/grocy_uisound.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/js/grocy_uisound.js?v=', true) }}{{ $version }}"></script>
@endpush @endpush
@section('content') @section('content')
@@ -15,8 +15,16 @@
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<div class="related-links"> <div class="related-links">
@if(!$embedded) @if(!$embedded)
<button id="scan-mode-button" class="btn @if(boolval($userSettings['scan_mode_consume_enabled'])) btn-success @else btn-danger @endif" type="checkbox">{{ $__t('Scan mode') }} <span id="scan-mode-status">@if(boolval($userSettings['scan_mode_consume_enabled'])) {{ $__t('on') }} @else {{ $__t('off') }} @endif</span></button> <button id="scan-mode-button"
<input id="scan-mode" type="checkbox" class="d-none user-setting-control" data-setting-key="scan_mode_consume_enabled" @if(boolval($userSettings['scan_mode_consume_enabled'])) checked @endif> class="btn @if(boolval($userSettings['scan_mode_consume_enabled'])) btn-success @else btn-danger @endif"
type="checkbox">{{ $__t('Scan mode') }} <span id="scan-mode-status">@if(boolval($userSettings['scan_mode_consume_enabled'])) {{ $__t('on') }} @else {{ $__t('off') }} @endif</span></button>
<input id="scan-mode"
type="checkbox"
class="d-none user-setting-control"
data-setting-key="scan_mode_consume_enabled"
@if(boolval($userSettings['scan_mode_consume_enabled']))
checked
@endif>
@else @else
<script> <script>
Grocy.UserSettings.scan_mode_consume_enabled = false; Grocy.UserSettings.scan_mode_consume_enabled = false;
@@ -26,39 +34,44 @@
</div> </div>
<hr> <hr>
<form id="consume-form" novalidate> <form id="consume-form"
novalidate>
@include('components.productpicker', array( @include('components.productpicker', array(
'products' => $products, 'products' => $products,
'barcodes' => $barcodes, 'barcodes' => $barcodes,
'nextInputSelector' => '#amount', 'nextInputSelector' => '#amount',
'disallowAddProductWorkflows' => true 'disallowAddProductWorkflows' => true
)) ))
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'amount', 'id' => 'amount',
'label' => 'Amount', 'label' => 'Amount',
'hintId' => 'amount_qu_unit', 'hintId' => 'amount_qu_unit',
'min' => 1, 'min' => 1,
'value' => 0, 'value' => 0,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'), 'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
'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>' '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>'
)) ))
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
@php /*@include('components.locationpicker', array( @php /*@include('components.locationpicker', array(
'id' => 'location_id', 'id' => 'location_id',
'locations' => $locations, 'locations' => $locations,
'isRequired' => true, 'isRequired' => true,
'label' => 'Location' 'label' => 'Location'
))*/ @endphp ))*/ @endphp
<div class="form-group"> <div class="form-group">
<label for="location_id">{{ $__t('Location') }}</label> <label for="location_id">{{ $__t('Location') }}</label>
<select required class="form-control location-combobox" id="location_id" name="location_id"> <select required
class="form-control location-combobox"
id="location_id"
name="location_id">
<option></option> <option></option>
@foreach($locations as $location) @foreach($locations as $location)
<option value="{{ $location->id }}">{{ $location->name }}</option> <option value="{{ $location->id }}">{{ $location->name }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('A location is required') }}</div> <div class="invalid-feedback">{{ $__t('A location is required') }}</div>
@@ -67,32 +80,41 @@
<div class="form-group"> <div class="form-group">
<label for="use_specific_stock_entry"> <label for="use_specific_stock_entry">
<input type="checkbox" id="use_specific_stock_entry" name="use_specific_stock_entry"> {{ $__t('Use a specific stock item') }} <input type="checkbox"
id="use_specific_stock_entry"
name="use_specific_stock_entry"> {{ $__t('Use a specific stock item') }}
<span class="small text-muted">{{ $__t('The first item in this list would be picked by the default rule which is "First expiring first, then first in first out"') }}</span> <span class="small text-muted">{{ $__t('The first item in this list would be picked by the default rule which is "First expiring first, then first in first out"') }}</span>
</label> </label>
<select disabled class="form-control" id="specific_stock_entry" name="specific_stock_entry"> <select disabled
class="form-control"
id="specific_stock_entry"
name="specific_stock_entry">
<option></option> <option></option>
</select> </select>
</div> </div>
<div class="checkbox"> <div class="checkbox">
<label for="spoiled"> <label for="spoiled">
<input type="checkbox" id="spoiled" name="spoiled"> {{ $__t('Spoiled') }} <input type="checkbox"
id="spoiled"
name="spoiled"> {{ $__t('Spoiled') }}
</label> </label>
</div> </div>
@if (GROCY_FEATURE_FLAG_RECIPES) @if (GROCY_FEATURE_FLAG_RECIPES)
@include('components.recipepicker', array( @include('components.recipepicker', array(
'recipes' => $recipes, 'recipes' => $recipes,
'isRequired' => false, 'isRequired' => false,
'hint' => $__t('This is for statistical purposes only') 'hint' => $__t('This is for statistical purposes only')
)) ))
@endif @endif
<button id="save-consume-button" class="btn btn-success">{{ $__t('OK') }}</button> <button id="save-consume-button"
class="btn btn-success">{{ $__t('OK') }}</button>
@if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING)
<button id="save-mark-as-open-button" class="btn btn-secondary permission-STOCK_OPEN">{{ $__t('Mark as opened') }}</button> <button id="save-mark-as-open-button"
class="btn btn-secondary permission-STOCK_OPEN">{{ $__t('Mark as opened') }}</button>
@endif @endif
</form> </form>

View File

@@ -13,25 +13,30 @@
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-4 col-xl-3"> <div class="col-xs-12 col-md-4 col-xl-3">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3" href="{{ $U('/equipment/new') }}"> <a class="btn btn-primary btn-sm responsive-button w-100 mb-3"
href="{{ $U('/equipment/new') }}">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
</div> </div>
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
<table id="equipment-table" class="table table-striped dt-responsive"> <table id="equipment-table"
class="table table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th>{{ $__t('Name') }}</th> <th>{{ $__t('Name') }}</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
@@ -44,8 +49,8 @@
</td> </td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $equipmentItem->id) 'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $equipmentItem->id)
)) ))
</tr> </tr>
@@ -57,49 +62,78 @@
<div class="col-xs-12 col-md-8"> <div class="col-xs-12 col-md-8">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#instruction-manual-tab">{{ $__t('Instruction manual') }}</a> <a class="nav-link active"
data-toggle="tab"
href="#instruction-manual-tab">{{ $__t('Instruction manual') }}</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#description-tab">{{ $__t('Notes') }}</a> <a class="nav-link"
data-toggle="tab"
href="#description-tab">{{ $__t('Notes') }}</a>
</li> </li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane fade show active" id="instruction-manual-tab"> <div class="tab-pane fade show active"
<div id="selectedEquipmentInstructionManualCard" class="card"> id="instruction-manual-tab">
<div id="selectedEquipmentInstructionManualCard"
class="card">
<div class="card-header card-header-fullscreen"> <div class="card-header card-header-fullscreen">
<i class="fas fa-toolbox"></i> <span class="selected-equipment-name"></span>&nbsp;&nbsp; <i class="fas fa-toolbox"></i> <span class="selected-equipment-name"></span>&nbsp;&nbsp;
<a class="btn btn-sm btn-outline-info py-0 equipment-edit-button hide-on-fullscreen-card" href="#"> <a class="btn btn-sm btn-outline-info py-0 equipment-edit-button hide-on-fullscreen-card"
href="#">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-sm btn-outline-danger py-0 equipment-delete-button hide-on-fullscreen-card" href="#" data-equipment-id="{{ $equipmentItem->id }}" data-equipment-name="{{ $equipmentItem->name }}"> <a class="btn btn-sm btn-outline-danger py-0 equipment-delete-button hide-on-fullscreen-card"
href="#"
data-equipment-id="{{ $equipmentItem->id }}"
data-equipment-name="{{ $equipmentItem->name }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
<a id="selectedEquipmentInstructionManualToggleFullscreenButton" class="btn btn-sm btn-outline-secondary py-0 float-right" href="#" data-toggle="tooltip" title="{{ $__t('Expand to fullscreen') }}"> <a id="selectedEquipmentInstructionManualToggleFullscreenButton"
class="btn btn-sm btn-outline-secondary py-0 float-right"
href="#"
data-toggle="tooltip"
title="{{ $__t('Expand to fullscreen') }}">
<i class="fas fa-expand-arrows-alt"></i> <i class="fas fa-expand-arrows-alt"></i>
</a> </a>
</div> </div>
<div class="card-body py-0 px-0"> <div class="card-body py-0 px-0">
<p id="selected-equipment-has-no-instruction-manual-hint" class="text-muted font-italic d-none pt-3 pl-3">{{ $__t('The selected equipment has no instruction manual') }}</p> <p id="selected-equipment-has-no-instruction-manual-hint"
<embed id="selected-equipment-instruction-manual" class="embed-responsive embed-responsive-4by3" src="" type="application/pdf"> class="text-muted font-italic d-none pt-3 pl-3">{{ $__t('The selected equipment has no instruction manual') }}</p>
<embed id="selected-equipment-instruction-manual"
class="embed-responsive embed-responsive-4by3"
src=""
type="application/pdf">
</div> </div>
</div> </div>
</div> </div>
<div class="tab-pane fade" id="description-tab"> <div class="tab-pane fade"
<div id="selectedEquipmentDescriptionCard" class="card"> id="description-tab">
<div id="selectedEquipmentDescriptionCard"
class="card">
<div class="card-header card-header-fullscreen"> <div class="card-header card-header-fullscreen">
<i class="fas fa-toolbox"></i> <span class="selected-equipment-name"></span>&nbsp;&nbsp; <i class="fas fa-toolbox"></i> <span class="selected-equipment-name"></span>&nbsp;&nbsp;
<a class="btn btn-sm btn-outline-info py-0 equipment-edit-button hide-on-fullscreen-card" href="#"> <a class="btn btn-sm btn-outline-info py-0 equipment-edit-button hide-on-fullscreen-card"
href="#">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-sm btn-outline-danger py-0 equipment-delete-button hide-on-fullscreen-card" href="#" data-equipment-id="{{ $equipmentItem->id }}" data-equipment-name="{{ $equipmentItem->name }}"> <a class="btn btn-sm btn-outline-danger py-0 equipment-delete-button hide-on-fullscreen-card"
href="#"
data-equipment-id="{{ $equipmentItem->id }}"
data-equipment-name="{{ $equipmentItem->name }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
<a id="selectedEquipmentDescriptionToggleFullscreenButton" class="btn btn-sm btn-outline-secondary py-0 float-right" href="#" data-toggle="tooltip" title="{{ $__t('Expand to fullscreen') }}"> <a id="selectedEquipmentDescriptionToggleFullscreenButton"
class="btn btn-sm btn-outline-secondary py-0 float-right"
href="#"
data-toggle="tooltip"
title="{{ $__t('Expand to fullscreen') }}">
<i class="fas fa-expand-arrows-alt"></i> <i class="fas fa-expand-arrows-alt"></i>
</a> </a>
</div> </div>
<div class="card-body"> <div class="card-body">
<div id="description-tab-content" class="mb-0"></div> <div id="description-tab-content"
class="mb-0"></div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit equipment')) @section('title', $__t('Edit equipment'))
@else @else
@section('title', $__t('Create equipment')) @section('title', $__t('Create equipment'))
@endif @endif
@section('viewJsName', 'equipmentform') @section('viewJsName', 'equipmentform')
@@ -18,21 +18,33 @@
<div class="row"> <div class="row">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<script>Grocy.EditMode = '{{ $mode }}';</script> <script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $equipment->id }};</script> <script>
Grocy.EditObjectId = {{ $equipment->id }};
</script>
@if(!empty($equipment->instruction_manual_file_name)) @if(!empty($equipment->instruction_manual_file_name))
<script>Grocy.InstructionManualFileNameName = '{{ $equipment->instruction_manual_file_name }}';</script> <script>
@endif Grocy.InstructionManualFileNameName = '{{ $equipment->instruction_manual_file_name }}';
</script>
@endif
@endif @endif
<form id="equipment-form" novalidate> <form id="equipment-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Name') }}</label> <label for="name">{{ $__t('Name') }}</label>
<input type="text" class="form-control" required id="name" name="name" value="@if($mode == 'edit'){{ $equipment->name }}@endif"> <input type="text"
class="form-control"
required
id="name"
name="name"
value="@if($mode == 'edit'){{ $equipment->name }}@endif">
<div class="invalid-feedback">{{ $__t('A name is required') }}</div> <div class="invalid-feedback">{{ $__t('A name is required') }}</div>
</div> </div>
@@ -41,34 +53,47 @@
<span class="text-muted small">{{ $__t('If you don\'t select a file, the current instruction manual will not be altered') }}</span> <span class="text-muted small">{{ $__t('If you don\'t select a file, the current instruction manual will not be altered') }}</span>
</label> </label>
<div class="custom-file"> <div class="custom-file">
<input type="file" class="custom-file-input" id="instruction-manual" accept="application/pdf"> <input type="file"
<label class="custom-file-label" for="instruction-manual">{{ $__t('No file selected') }}</label> class="custom-file-input"
id="instruction-manual"
accept="application/pdf">
<label class="custom-file-label"
for="instruction-manual">{{ $__t('No file selected') }}</label>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="description">{{ $__t('Notes') }}</label> <label for="description">{{ $__t('Notes') }}</label>
<textarea class="form-control wysiwyg-editor" id="description" name="description">@if($mode == 'edit'){{ $equipment->description }}@endif</textarea> <textarea class="form-control wysiwyg-editor"
id="description"
name="description">@if($mode == 'edit'){{ $equipment->description }}@endif</textarea>
</div> </div>
@include('components.userfieldsform', array( @include('components.userfieldsform', array(
'userfields' => $userfields, 'userfields' => $userfields,
'entity' => 'equipment' 'entity' => 'equipment'
)) ))
<button id="save-equipment-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-equipment-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<label class="mt-2">{{ $__t('Instruction manual') }}</label> <label class="mt-2">{{ $__t('Instruction manual') }}</label>
<button id="delete-current-instruction-manual-button" class="btn btn-sm btn-danger mb-1 @if(empty($equipment->instruction_manual_file_name)) disabled @endif"><i class="fas fa-trash"></i> {{ $__t('Delete') }}</button> <button id="delete-current-instruction-manual-button"
class="btn btn-sm btn-danger mb-1 @if(empty($equipment->instruction_manual_file_name)) disabled @endif"><i class="fas fa-trash"></i> {{ $__t('Delete') }}</button>
@if(!empty($equipment->instruction_manual_file_name)) @if(!empty($equipment->instruction_manual_file_name))
<embed id="current-equipment-instruction-manual" class="embed-responsive embed-responsive-4by3" src="{{ $U('/api/files/equipmentmanuals/' . base64_encode($equipment->instruction_manual_file_name)) }}" type="application/pdf"> <embed id="current-equipment-instruction-manual"
<p id="delete-current-instruction-manual-on-save-hint" class="form-text text-muted font-italic d-none">{{ $__t('The current instruction manual will be deleted when you save the equipment') }}</p> class="embed-responsive embed-responsive-4by3"
src="{{ $U('/api/files/equipmentmanuals/' . base64_encode($equipment->instruction_manual_file_name)) }}"
type="application/pdf">
<p id="delete-current-instruction-manual-on-save-hint"
class="form-text text-muted font-italic d-none">{{ $__t('The current instruction manual will be deleted when you save the equipment') }}</p>
@else @else
<p id="no-current-instruction-manual-hint" class="form-text text-muted font-italic">{{ $__t('No instruction manual available') }}</p> <p id="no-current-instruction-manual-hint"
class="form-text text-muted font-italic">{{ $__t('No instruction manual available') }}</p>
@endif @endif
</div> </div>
</div> </div>

View File

@@ -3,9 +3,9 @@
@section('title', $__t('Unauthorized')) @section('title', $__t('Unauthorized'))
@section('content') @section('content')
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<h1 class="alert alert-danger">{{ $__t('You are not allowed to view this page') }}</h1> <h1 class="alert alert-danger">{{ $__t('You are not allowed to view this page') }}</h1>
</div>
</div> </div>
</div>
@stop @stop

View File

@@ -3,11 +3,12 @@
@section('title', $__t('Page not found')) @section('title', $__t('Page not found'))
@section('content') @section('content')
<meta http-equiv="refresh" content="5;url={{$U('/')}}"> <meta http-equiv="refresh"
<div class="row"> content="5;url={{$U('/')}}">
<div class="col"> <div class="row">
<h1 class="alert alert-danger">{{ $__t('This page does not exist') }}</h1> <div class="col">
<div class="alert alert-info">{{ $__t('You will be redirected to the default page in %s seconds', '5') }}</div> <h1 class="alert alert-danger">{{ $__t('This page does not exist') }}</h1>
</div> <div class="alert alert-info">{{ $__t('You will be redirected to the default page in %s seconds', '5') }}</div>
</div> </div>
</div>
@stop @stop

View File

@@ -3,14 +3,15 @@
@section('title', $__t('Server error')) @section('title', $__t('Server error'))
@section('content') @section('content')
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<h1 class="alert alert-danger">{{ $__t('A server error occured while processing your request') }}</h1> <h1 class="alert alert-danger">{{ $__t('A server error occured while processing your request') }}</h1>
<div class="alert alert-info"> <div class="alert alert-info">
{{ $__t('If you think this is a bug, please report it') }}<br> {{ $__t('If you think this is a bug, please report it') }}<br>
&rarr; <a target="_blank" href="https://github.com/grocy/grocy/issues">https://github.com/grocy/grocy/issues</a> &rarr; <a target="_blank"
</div> href="https://github.com/grocy/grocy/issues">https://github.com/grocy/grocy/issues</a>
</div> </div>
</div> </div>
@parent </div>
@parent
@stop @stop

View File

@@ -1,20 +1,20 @@
@extends('layout.default') @extends('layout.default')
@section('content') @section('content')
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="alert alert-dark py-1"> <div class="alert alert-dark py-1">
<h4>{{ $__t('Error source') }}</h4> <h4>{{ $__t('Error source') }}</h4>
<pre class="my-0"><code>{!! $exception->getFile() !!}:{!! $exception->getLine() !!}</code></pre> <pre class="my-0"><code>{!! $exception->getFile() !!}:{!! $exception->getLine() !!}</code></pre>
</div> </div>
<div class="alert alert-dark py-1"> <div class="alert alert-dark py-1">
<h4>{{ $__t('Error message') }}</h4> <h4>{{ $__t('Error message') }}</h4>
<pre class="my-0"><code>{!! $exception->getMessage() !!}</code></pre> <pre class="my-0"><code>{!! $exception->getMessage() !!}</code></pre>
</div> </div>
<div class="alert alert-dark py-1"> <div class="alert alert-dark py-1">
<h4>{{ $__t('Stack trace') }}</h4> <h4>{{ $__t('Stack trace') }}</h4>
<pre class="my-0"><code>{!! $exception->getTraceAsString() !!}</code></pre> <pre class="my-0"><code>{!! $exception->getTraceAsString() !!}</code></pre>
</div>
</div> </div>
</div> </div>
</div>
@stop @stop

View File

@@ -9,82 +9,89 @@
<div class="col-xs-12 col-md-6 col-xl-4 pb-3"> <div class="col-xs-12 col-md-6 col-xl-4 pb-3">
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<hr> <hr>
<form id="inventory-form" novalidate> <form id="inventory-form"
novalidate>
@include('components.productpicker', array( @include('components.productpicker', array(
'products' => $products, 'products' => $products,
'barcodes' => $barcodes, 'barcodes' => $barcodes,
'nextInputSelector' => '#new_amount' 'nextInputSelector' => '#new_amount'
)) ))
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'new_amount', 'id' => 'new_amount',
'label' => 'New amount', 'label' => 'New amount',
'hintId' => 'new_amount_qu_unit', 'hintId' => 'new_amount_qu_unit',
'min' => 0, 'min' => 0,
'value' => 1, 'value' => 1,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '0'), 'invalidFeedback' => $__t('The amount cannot be lower than %s', '0'),
'additionalAttributes' => 'data-not-equal="-1"', 'additionalAttributes' => 'data-not-equal="-1"',
'additionalHtmlElements' => '<div id="inventory-change-info" class="form-text text-muted small d-none"></div>', 'additionalHtmlElements' => '<div id="inventory-change-info"
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info" class="text-small 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>' class="form-text text-muted small d-none"></div>',
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info"
class="text-small 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>'
)) ))
@php @php
$additionalGroupCssClasses = ''; $additionalGroupCssClasses = '';
if (!GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) if (!GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
{ {
$additionalGroupCssClasses = 'd-none'; $additionalGroupCssClasses = 'd-none';
} }
@endphp @endphp
@include('components.datetimepicker', array( @include('components.datetimepicker', array(
'id' => 'best_before_date', 'id' => 'best_before_date',
'label' => 'Best before', 'label' => 'Best before',
'hint' => 'This will apply to added products', 'hint' => 'This will apply to added products',
'format' => 'YYYY-MM-DD', 'format' => 'YYYY-MM-DD',
'initWithNow' => false, 'initWithNow' => false,
'limitEndToNow' => false, 'limitEndToNow' => false,
'limitStartToNow' => false, 'limitStartToNow' => false,
'invalidFeedback' => $__t('A best before date is required'), 'invalidFeedback' => $__t('A best before date is required'),
'nextInputSelector' => '#best_before_date', 'nextInputSelector' => '#best_before_date',
'additionalGroupCssClasses' => 'date-only-datetimepicker', 'additionalGroupCssClasses' => 'date-only-datetimepicker',
'shortcutValue' => '2999-12-31', 'shortcutValue' => '2999-12-31',
'shortcutLabel' => 'Never expires', 'shortcutLabel' => 'Never expires',
'earlierThanInfoLimit' => date('Y-m-d'), 'earlierThanInfoLimit' => date('Y-m-d'),
'earlierThanInfoText' => $__t('The given date is earlier than today, are you sure?'), 'earlierThanInfoText' => $__t('The given date is earlier than today, are you sure?'),
'additionalGroupCssClasses' => $additionalGroupCssClasses, 'additionalGroupCssClasses' => $additionalGroupCssClasses,
'activateNumberPad' => GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD 'activateNumberPad' => GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD
)) ))
@php $additionalGroupCssClasses = ''; @endphp @php $additionalGroupCssClasses = ''; @endphp
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'price', 'id' => 'price',
'label' => 'Price', 'label' => 'Price',
'min' => 0, 'min' => 0,
'step' => 0.01, 'step' => 0.01,
'value' => '', 'value' => '',
'hint' => $__t('in %s per purchase quantity unit', GROCY_CURRENCY), 'hint' => $__t('in %s per purchase quantity unit', GROCY_CURRENCY),
'additionalHtmlContextHelp' => '<br><span class="small text-muted">' . $__t('This will apply to added products') . '</span>', 'additionalHtmlContextHelp' => '<br><span class="small text-muted">' . $__t('This will apply to added products') . '</span>',
'invalidFeedback' => $__t('The price cannot be lower than %s', '0'), 'invalidFeedback' => $__t('The price cannot be lower than %s', '0'),
'isRequired' => false 'isRequired' => false
)) ))
@include('components.shoppinglocationpicker', array( @include('components.shoppinglocationpicker', array(
'label' => 'Store', 'label' => 'Store',
'shoppinglocations' => $shoppinglocations 'shoppinglocations' => $shoppinglocations
)) ))
@else @else
<input type="hidden" name="price" id="price" value="0"> <input type="hidden"
name="price"
id="price"
value="0">
@endif @endif
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
@include('components.locationpicker', array( @include('components.locationpicker', array(
'locations' => $locations, 'locations' => $locations,
'hint' => $__t('This will apply to added products') 'hint' => $__t('This will apply to added products')
)) ))
@endif @endif
<button id="save-inventory-button" class="btn btn-success">{{ $__t('OK') }}</button> <button id="save-inventory-button"
class="btn btn-success">{{ $__t('OK') }}</button>
</form> </form>
</div> </div>

View File

@@ -1,48 +1,86 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ GROCY_LOCALE }}"> <html lang="{{ GROCY_LOCALE }}">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge"> <meta http-equiv="x-ua-compatible"
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> content="ie=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="robots" content="noindex,nofollow"> <meta name="robots"
<meta name="format-detection" content="telephone=no"> content="noindex,nofollow">
<meta name="format-detection"
content="telephone=no">
<meta name="author" content="Bernd Bestel (bernd@berrnd.de)"> <meta name="author"
content="Bernd Bestel (bernd@berrnd.de)">
<link rel="apple-touch-icon" sizes="180x180" href="{{ $U('/img/appicons/apple-touch-icon.png?v=', true) }}{{ $version }}"> <link rel="apple-touch-icon"
<link rel="icon" type="image/png" sizes="32x32" href="{{ $U('/img/appicons/favicon-32x32.png?v=', true) }}{{ $version }}"> sizes="180x180"
<link rel="icon" type="image/png" sizes="16x16" href="{{ $U('/img/appicons/favicon-16x16.png?v=', true) }}{{ $version }}"> href="{{ $U('/img/appicons/apple-touch-icon.png?v=', true) }}{{ $version }}">
<link rel="manifest" href="{{ $U('/img/appicons/site.webmanifest?v=', true) }}{{ $version }}"> <link rel="icon"
<link rel="mask-icon" href="{{ $U('/img/appicons/safari-pinned-tab.svg?v=', true) }}{{ $version }}" color="#0b024c"> type="image/png"
<link rel="shortcut icon" href="{{ $U('/img/appicons/favicon.ico?v=', true) }}{{ $version }}"> sizes="32x32"
<meta name="apple-mobile-web-app-title" content="grocy"> href="{{ $U('/img/appicons/favicon-32x32.png?v=', true) }}{{ $version }}">
<meta name="application-name" content="grocy"> <link rel="icon"
<meta name="msapplication-TileColor" content="#e5e5e5"> type="image/png"
<meta name="msapplication-config" content="{{ $U('/img/appicons/browserconfig.xml?v=', true) }}{{ $version }}"> sizes="16x16"
<meta name="theme-color" content="#ffffff"> href="{{ $U('/img/appicons/favicon-16x16.png?v=', true) }}{{ $version }}">
<link rel="manifest"
href="{{ $U('/img/appicons/site.webmanifest?v=', true) }}{{ $version }}">
<link rel="mask-icon"
href="{{ $U('/img/appicons/safari-pinned-tab.svg?v=', true) }}{{ $version }}"
color="#0b024c">
<link rel="shortcut icon"
href="{{ $U('/img/appicons/favicon.ico?v=', true) }}{{ $version }}">
<meta name="apple-mobile-web-app-title"
content="grocy">
<meta name="application-name"
content="grocy">
<meta name="msapplication-TileColor"
content="#e5e5e5">
<meta name="msapplication-config"
content="{{ $U('/img/appicons/browserconfig.xml?v=', true) }}{{ $version }}">
<meta name="theme-color"
content="#ffffff">
<title>@yield('title') | grocy</title> <title>@yield('title') | grocy</title>
<link href="{{ $U('/node_modules/bootstrap/dist/css/bootstrap.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/bootstrap/dist/css/bootstrap.min.css?v=', true) }}{{ $version }}"
<link href="{{ $U('/node_modules/startbootstrap-sb-admin/css/sb-admin.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> rel="stylesheet">
<link href="{{ $U('/node_modules/@fortawesome/fontawesome-free/css/all.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/startbootstrap-sb-admin/css/sb-admin.min.css?v=', true) }}{{ $version }}"
<link href="{{ $U('/node_modules/@danielfarrell/bootstrap-combobox/css/bootstrap-combobox.css?v=', true) }}{{ $version }}" rel="stylesheet"> rel="stylesheet">
<link href="{{ $U('/node_modules/datatables.net-bs4/css/dataTables.bootstrap4.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/@fortawesome/fontawesome-free/css/all.css?v=', true) }}{{ $version }}"
<link href="{{ $U('/node_modules/datatables.net-responsive-bs4/css/responsive.bootstrap4.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> rel="stylesheet">
<link href="{{ $U('/node_modules/datatables.net-colreorder-bs4/css/colReorder.bootstrap4.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/@danielfarrell/bootstrap-combobox/css/bootstrap-combobox.css?v=', true) }}{{ $version }}"
<link href="{{ $U('/node_modules/datatables.net-select-bs4/css/select.bootstrap4.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> rel="stylesheet">
<link href="{{ $U('/node_modules/toastr/build/toastr.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/datatables.net-bs4/css/dataTables.bootstrap4.min.css?v=', true) }}{{ $version }}"
<link href="{{ $U('/node_modules/tempusdominus-bootstrap-4/build/css/tempusdominus-bootstrap-4.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> rel="stylesheet">
<link href="{{ $U('/node_modules/summernote/dist/summernote-bs4.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/datatables.net-responsive-bs4/css/responsive.bootstrap4.min.css?v=', true) }}{{ $version }}"
<link href="{{ $U('/node_modules/bootstrap-select/dist/css/bootstrap-select.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> rel="stylesheet">
<link href="{{ $U('/components_unmanaged/noto-sans-v9-latin/noto-sans-v9-latin.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/datatables.net-colreorder-bs4/css/colReorder.bootstrap4.min.css?v=', true) }}{{ $version }}"
<link href="{{ $U('/css/grocy.css?v=', true) }}{{ $version }}" rel="stylesheet"> rel="stylesheet">
<link href="{{ $U('/css/grocy_night_mode.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/datatables.net-select-bs4/css/select.bootstrap4.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
<link href="{{ $U('/node_modules/toastr/build/toastr.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
<link href="{{ $U('/node_modules/tempusdominus-bootstrap-4/build/css/tempusdominus-bootstrap-4.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
<link href="{{ $U('/node_modules/summernote/dist/summernote-bs4.css?v=', true) }}{{ $version }}"
rel="stylesheet">
<link href="{{ $U('/node_modules/bootstrap-select/dist/css/bootstrap-select.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
<link href="{{ $U('/components_unmanaged/noto-sans-v9-latin/noto-sans-v9-latin.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
<link href="{{ $U('/css/grocy.css?v=', true) }}{{ $version }}"
rel="stylesheet">
<link href="{{ $U('/css/grocy_night_mode.css?v=', true) }}{{ $version }}"
rel="stylesheet">
@stack('pageStyles') @stack('pageStyles')
@if(file_exists(GROCY_DATAPATH . '/custom_css.html')) @if(file_exists(GROCY_DATAPATH . '/custom_css.html'))
@php include GROCY_DATAPATH . '/custom_css.html' @endphp @php include GROCY_DATAPATH . '/custom_css.html' @endphp
@endif @endif
<script> <script>
@@ -72,33 +110,53 @@
<body class="fixed-nav @if(boolval($userSettings['night_mode_enabled']) || (boolval($userSettings['auto_night_mode_enabled']) && boolval($userSettings['currently_inside_night_mode_range']))) night-mode @endif @if($embedded) embedded @endif"> <body class="fixed-nav @if(boolval($userSettings['night_mode_enabled']) || (boolval($userSettings['auto_night_mode_enabled']) && boolval($userSettings['currently_inside_night_mode_range']))) night-mode @endif @if($embedded) embedded @endif">
@if(!($embedded)) @if(!($embedded))
<nav id="mainNav" class="navbar navbar-expand-lg navbar-light fixed-top"> <nav id="mainNav"
<a class="navbar-brand py-0" href="{{ $U('/') }}"><img src="{{ $U('/img/grocy_logo.svg?v=', true) }}{{ $version }}" height="30"></a> class="navbar navbar-expand-lg navbar-light fixed-top">
<span id="clock-container" class="text-muted font-italic d-none"> <a class="navbar-brand py-0"
href="{{ $U('/') }}"><img src="{{ $U('/img/grocy_logo.svg?v=', true) }}{{ $version }}"
height="30"></a>
<span id="clock-container"
class="text-muted font-italic d-none">
<i class="far fa-clock"></i> <i class="far fa-clock"></i>
<span id="clock-small" class="d-inline d-sm-none"></span> <span id="clock-small"
<span id="clock-big" class="d-none d-sm-inline"></span> class="d-inline d-sm-none"></span>
<span id="clock-big"
class="d-none d-sm-inline"></span>
</span> </span>
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#sidebarResponsive"> <button class="navbar-toggler navbar-toggler-right"
type="button"
data-toggle="collapse"
data-target="#sidebarResponsive">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
@if(GROCY_AUTHENTICATED) @if(GROCY_AUTHENTICATED)
<div id="sidebarResponsive" class="collapse navbar-collapse"> <div id="sidebarResponsive"
class="collapse navbar-collapse">
<ul class="navbar-nav navbar-sidenav"> <ul class="navbar-nav navbar-sidenav">
@if(GROCY_FEATURE_FLAG_STOCK) @if(GROCY_FEATURE_FLAG_STOCK)
<li class="nav-item nav-item-sidebar" data-toggle="tooltip" data-placement="right" title="{{ $__t('Stock overview') }}" data-nav-for-page="stockoverview"> <li class="nav-item nav-item-sidebar"
<a class="nav-link discrete-link" href="{{ $U('/stockoverview') }}"> data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Stock overview') }}"
data-nav-for-page="stockoverview">
<a class="nav-link discrete-link"
href="{{ $U('/stockoverview') }}">
<i class="fas fa-box"></i> <i class="fas fa-box"></i>
<span class="nav-link-text">{{ $__t('Stock overview') }}</span> <span class="nav-link-text">{{ $__t('Stock overview') }}</span>
</a> </a>
</li> </li>
@endif @endif
@if(GROCY_FEATURE_FLAG_SHOPPINGLIST) @if(GROCY_FEATURE_FLAG_SHOPPINGLIST)
<li class="nav-item nav-item-sidebar" data-toggle="tooltip" data-placement="right" title="{{ $__t('Shopping list') }}" data-nav-for-page="shoppinglist"> <li class="nav-item nav-item-sidebar"
<a class="nav-link discrete-link" href="{{ $U('/shoppinglist') }}"> data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Shopping list') }}"
data-nav-for-page="shoppinglist">
<a class="nav-link discrete-link"
href="{{ $U('/shoppinglist') }}">
<i class="fas fa-shopping-cart"></i> <i class="fas fa-shopping-cart"></i>
<span class="nav-link-text">{{ $__t('Shopping list') }}</span> <span class="nav-link-text">{{ $__t('Shopping list') }}</span>
</a> </a>
@@ -106,14 +164,24 @@
@endif @endif
@if(GROCY_FEATURE_FLAG_RECIPES) @if(GROCY_FEATURE_FLAG_RECIPES)
<div class="nav-item-divider"></div> <div class="nav-item-divider"></div>
<li class="nav-item nav-item-sidebar permission-RECIPES" data-toggle="tooltip" data-placement="right" title="{{ $__t('Recipes') }}" data-nav-for-page="recipes"> <li class="nav-item nav-item-sidebar permission-RECIPES"
<a class="nav-link discrete-link" href="{{ $U('/recipes') }}"> data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Recipes') }}"
data-nav-for-page="recipes">
<a class="nav-link discrete-link"
href="{{ $U('/recipes') }}">
<i class="fas fa-cocktail"></i> <i class="fas fa-cocktail"></i>
<span class="nav-link-text">{{ $__t('Recipes') }}</span> <span class="nav-link-text">{{ $__t('Recipes') }}</span>
</a> </a>
</li> </li>
<li class="nav-item nav-item-sidebar permission-RECIPES_MEALPLAN" data-toggle="tooltip" data-placement="right" title="{{ $__t('Meal plan') }}" data-nav-for-page="mealplan"> <li class="nav-item nav-item-sidebar permission-RECIPES_MEALPLAN"
<a class="nav-link discrete-link" href="{{ $U('/mealplan') }}"> data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Meal plan') }}"
data-nav-for-page="mealplan">
<a class="nav-link discrete-link"
href="{{ $U('/mealplan') }}">
<i class="fas fa-paper-plane"></i> <i class="fas fa-paper-plane"></i>
<span class="nav-link-text">{{ $__t('Meal plan') }}</span> <span class="nav-link-text">{{ $__t('Meal plan') }}</span>
</a> </a>
@@ -121,32 +189,52 @@
@endif @endif
@if(GROCY_FEATURE_FLAG_CHORES) @if(GROCY_FEATURE_FLAG_CHORES)
<div class="nav-item-divider"></div> <div class="nav-item-divider"></div>
<li class="nav-item nav-item-sidebar" data-toggle="tooltip" data-placement="right" title="{{ $__t('Chores overview') }}" data-nav-for-page="choresoverview"> <li class="nav-item nav-item-sidebar"
<a class="nav-link discrete-link" href="{{ $U('/choresoverview') }}"> data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Chores overview') }}"
data-nav-for-page="choresoverview">
<a class="nav-link discrete-link"
href="{{ $U('/choresoverview') }}">
<i class="fas fa-home"></i> <i class="fas fa-home"></i>
<span class="nav-link-text">{{ $__t('Chores overview') }}</span> <span class="nav-link-text">{{ $__t('Chores overview') }}</span>
</a> </a>
</li> </li>
@endif @endif
@if(GROCY_FEATURE_FLAG_TASKS) @if(GROCY_FEATURE_FLAG_TASKS)
<li class="nav-item nav-item-sidebar" data-toggle="tooltip" data-placement="right" title="{{ $__t('Tasks') }}" data-nav-for-page="tasks"> <li class="nav-item nav-item-sidebar"
<a class="nav-link discrete-link" href="{{ $U('/tasks') }}"> data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Tasks') }}"
data-nav-for-page="tasks">
<a class="nav-link discrete-link"
href="{{ $U('/tasks') }}">
<i class="fas fa-tasks"></i> <i class="fas fa-tasks"></i>
<span class="nav-link-text">{{ $__t('Tasks') }}</span> <span class="nav-link-text">{{ $__t('Tasks') }}</span>
</a> </a>
</li> </li>
@endif @endif
@if(GROCY_FEATURE_FLAG_BATTERIES) @if(GROCY_FEATURE_FLAG_BATTERIES)
<li class="nav-item nav-item-sidebar" data-toggle="tooltip" data-placement="right" title="{{ $__t('Batteries overview') }}" data-nav-for-page="batteriesoverview"> <li class="nav-item nav-item-sidebar"
<a class="nav-link discrete-link" href="{{ $U('/batteriesoverview') }}"> data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Batteries overview') }}"
data-nav-for-page="batteriesoverview">
<a class="nav-link discrete-link"
href="{{ $U('/batteriesoverview') }}">
<i class="fas fa-battery-half"></i> <i class="fas fa-battery-half"></i>
<span class="nav-link-text">{{ $__t('Batteries overview') }}</span> <span class="nav-link-text">{{ $__t('Batteries overview') }}</span>
</a> </a>
</li> </li>
@endif @endif
@if(GROCY_FEATURE_FLAG_EQUIPMENT) @if(GROCY_FEATURE_FLAG_EQUIPMENT)
<li class="nav-item nav-item-sidebar permission-EQUIPMENT" data-toggle="tooltip" data-placement="right" title="{{ $__t('Equipment') }}" data-nav-for-page="equipment"> <li class="nav-item nav-item-sidebar permission-EQUIPMENT"
<a class="nav-link discrete-link" href="{{ $U('/equipment') }}"> data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Equipment') }}"
data-nav-for-page="equipment">
<a class="nav-link discrete-link"
href="{{ $U('/equipment') }}">
<i class="fas fa-toolbox"></i> <i class="fas fa-toolbox"></i>
<span class="nav-link-text">{{ $__t('Equipment') }}</span> <span class="nav-link-text">{{ $__t('Equipment') }}</span>
</a> </a>
@@ -154,8 +242,13 @@
@endif @endif
@if(GROCY_FEATURE_FLAG_CALENDAR) @if(GROCY_FEATURE_FLAG_CALENDAR)
<div class="nav-item-divider"></div> <div class="nav-item-divider"></div>
<li class="nav-item nav-item-sidebar permission-CALENDAR" data-toggle="tooltip" data-placement="right" title="{{ $__t('Calendar') }}" data-nav-for-page="calendar"> <li class="nav-item nav-item-sidebar permission-CALENDAR"
<a class="nav-link discrete-link" href="{{ $U('/calendar') }}"> data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Calendar') }}"
data-nav-for-page="calendar">
<a class="nav-link discrete-link"
href="{{ $U('/calendar') }}">
<i class="fas fa-calendar-alt"></i> <i class="fas fa-calendar-alt"></i>
<span class="nav-link-text">{{ $__t('Calendar') }}</span> <span class="nav-link-text">{{ $__t('Calendar') }}</span>
</a> </a>
@@ -164,44 +257,74 @@
@if(GROCY_FEATURE_FLAG_STOCK) @if(GROCY_FEATURE_FLAG_STOCK)
<div class="nav-item-divider"></div> <div class="nav-item-divider"></div>
<li class="nav-item nav-item-sidebar permission-STOCK_PURCHASE" data-toggle="tooltip" data-placement="right" title="{{ $__t('Purchase') }}" data-nav-for-page="purchase"> <li class="nav-item nav-item-sidebar permission-STOCK_PURCHASE"
<a class="nav-link discrete-link" href="{{ $U('/purchase') }}"> data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Purchase') }}"
data-nav-for-page="purchase">
<a class="nav-link discrete-link"
href="{{ $U('/purchase') }}">
<i class="fas fa-shopping-cart"></i> <i class="fas fa-shopping-cart"></i>
<span class="nav-link-text">{{ $__t('Purchase') }}</span> <span class="nav-link-text">{{ $__t('Purchase') }}</span>
</a> </a>
</li> </li>
<li class="nav-item nav-item-sidebar permission-STOCK_CONSUME" data-toggle="tooltip" data-placement="right" title="{{ $__t('Consume') }}" data-nav-for-page="consume"> <li class="nav-item nav-item-sidebar permission-STOCK_CONSUME"
<a class="nav-link discrete-link" href="{{ $U('/consume') }}"> data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Consume') }}"
data-nav-for-page="consume">
<a class="nav-link discrete-link"
href="{{ $U('/consume') }}">
<i class="fas fa-utensils"></i> <i class="fas fa-utensils"></i>
<span class="nav-link-text">{{ $__t('Consume') }}</span> <span class="nav-link-text">{{ $__t('Consume') }}</span>
</a> </a>
</li> </li>
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
<li class="nav-item nav-item-sidebar permission-STOCK_TRANSFER" data-toggle="tooltip" data-placement="right" title="{{ $__t('Transfer') }}" data-nav-for-page="transfer"> <li class="nav-item nav-item-sidebar permission-STOCK_TRANSFER"
<a class="nav-link discrete-link" href="{{ $U('/transfer') }}"> data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Transfer') }}"
data-nav-for-page="transfer">
<a class="nav-link discrete-link"
href="{{ $U('/transfer') }}">
<i class="fas fa-exchange-alt"></i> <i class="fas fa-exchange-alt"></i>
<span class="nav-link-text">{{ $__t('Transfer') }}</span> <span class="nav-link-text">{{ $__t('Transfer') }}</span>
</a> </a>
</li> </li>
@endif @endif
<li class="nav-item nav-item-sidebar permission-STOCK_INVENTORY" data-toggle="tooltip" data-placement="right" title="{{ $__t('Inventory') }}" data-nav-for-page="inventory"> <li class="nav-item nav-item-sidebar permission-STOCK_INVENTORY"
<a class="nav-link discrete-link" href="{{ $U('/inventory') }}"> data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Inventory') }}"
data-nav-for-page="inventory">
<a class="nav-link discrete-link"
href="{{ $U('/inventory') }}">
<i class="fas fa-list"></i> <i class="fas fa-list"></i>
<span class="nav-link-text">{{ $__t('Inventory') }}</span> <span class="nav-link-text">{{ $__t('Inventory') }}</span>
</a> </a>
</li> </li>
@endif @endif
@if(GROCY_FEATURE_FLAG_CHORES) @if(GROCY_FEATURE_FLAG_CHORES)
<li class="nav-item nav-item-sidebar permission-CHORE_TRACK_EXECUTION" data-toggle="tooltip" data-placement="right" title="{{ $__t('Chore tracking') }}" data-nav-for-page="choretracking"> <li class="nav-item nav-item-sidebar permission-CHORE_TRACK_EXECUTION"
<a class="nav-link discrete-link" href="{{ $U('/choretracking') }}"> data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Chore tracking') }}"
data-nav-for-page="choretracking">
<a class="nav-link discrete-link"
href="{{ $U('/choretracking') }}">
<i class="fas fa-play"></i> <i class="fas fa-play"></i>
<span class="nav-link-text">{{ $__t('Chore tracking') }}</span> <span class="nav-link-text">{{ $__t('Chore tracking') }}</span>
</a> </a>
</li> </li>
@endif @endif
@if(GROCY_FEATURE_FLAG_BATTERIES) @if(GROCY_FEATURE_FLAG_BATTERIES)
<li class="nav-item nav-item-sidebar permission-BATTERIES_TRACK_CHARGE_CYCLE" data-toggle="tooltip" data-placement="right" title="{{ $__t('Battery tracking') }}" data-nav-for-page="batterytracking"> <li class="nav-item nav-item-sidebar permission-BATTERIES_TRACK_CHARGE_CYCLE"
<a class="nav-link discrete-link" href="{{ $U('/batterytracking') }}"> data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Battery tracking') }}"
data-nav-for-page="batterytracking">
<a class="nav-link discrete-link"
href="{{ $U('/batterytracking') }}">
<i class="fas fa-fire"></i> <i class="fas fa-fire"></i>
<span class="nav-link-text">{{ $__t('Battery tracking') }}</span> <span class="nav-link-text">{{ $__t('Battery tracking') }}</span>
</a> </a>
@@ -213,8 +336,13 @@
@if($firstUserentity) @if($firstUserentity)
<div class="nav-item-divider"></div> <div class="nav-item-divider"></div>
@endif @endif
<li class="nav-item nav-item-sidebar" data-toggle="tooltip" data-placement="right" title="{{ $userentity->caption }}" data-nav-for-page="userentity-{{ $userentity->name }}"> <li class="nav-item nav-item-sidebar"
<a class="nav-link discrete-link" href="{{ $U('/userobjects/' . $userentity->name) }}"> data-toggle="tooltip"
data-placement="right"
title="{{ $userentity->caption }}"
data-nav-for-page="userentity-{{ $userentity->name }}">
<a class="nav-link discrete-link"
href="{{ $U('/userobjects/' . $userentity->name) }}">
<i class="{{ $userentity->icon_css_class }}"></i> <i class="{{ $userentity->icon_css_class }}"></i>
<span class="nav-link-text">{{ $userentity->caption }}</span> <span class="nav-link-text">{{ $userentity->caption }}</span>
</a> </a>
@@ -223,80 +351,106 @@
@endforeach @endforeach
<div class="nav-item-divider"></div> <div class="nav-item-divider"></div>
<li class="nav-item nav-item-sidebar" data-toggle="tooltip" data-placement="right" title="{{ $__t('Manage master data') }}"> <li class="nav-item nav-item-sidebar"
<a class="nav-link nav-link-collapse collapsed discrete-link" data-toggle="collapse" href="#top-nav-manager-master-data"> data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Manage master data') }}">
<a class="nav-link nav-link-collapse collapsed discrete-link"
data-toggle="collapse"
href="#top-nav-manager-master-data">
<i class="fas fa-table"></i> <i class="fas fa-table"></i>
<span class="nav-link-text">{{ $__t('Manage master data') }}</span> <span class="nav-link-text">{{ $__t('Manage master data') }}</span>
</a> </a>
<ul id="top-nav-manager-master-data" class="sidenav-second-level collapse"> <ul id="top-nav-manager-master-data"
class="sidenav-second-level collapse">
@if(GROCY_FEATURE_FLAG_STOCK) @if(GROCY_FEATURE_FLAG_STOCK)
<li data-nav-for-page="products" data-sub-menu-of="#top-nav-manager-master-data"> <li data-nav-for-page="products"
<a class="nav-link discrete-link" href="{{ $U('/products') }}"> data-sub-menu-of="#top-nav-manager-master-data">
<a class="nav-link discrete-link"
href="{{ $U('/products') }}">
<i class="fab fa-product-hunt"></i> <i class="fab fa-product-hunt"></i>
<span class="nav-link-text">{{ $__t('Products') }}</span> <span class="nav-link-text">{{ $__t('Products') }}</span>
</a> </a>
</li> </li>
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
<li data-nav-for-page="locations" data-sub-menu-of="#top-nav-manager-master-data"> <li data-nav-for-page="locations"
<a class="nav-link discrete-link" href="{{ $U('/locations') }}"> data-sub-menu-of="#top-nav-manager-master-data">
<a class="nav-link discrete-link"
href="{{ $U('/locations') }}">
<i class="fas fa-map-marker-alt"></i> <i class="fas fa-map-marker-alt"></i>
<span class="nav-link-text">{{ $__t('Locations') }}</span> <span class="nav-link-text">{{ $__t('Locations') }}</span>
</a> </a>
</li> </li>
@endif @endif
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
<li data-nav-for-page="shoppinglocations" data-sub-menu-of="#top-nav-manager-master-data"> <li data-nav-for-page="shoppinglocations"
<a class="nav-link discrete-link" href="{{ $U('/shoppinglocations') }}"> data-sub-menu-of="#top-nav-manager-master-data">
<a class="nav-link discrete-link"
href="{{ $U('/shoppinglocations') }}">
<i class="fas fa-shopping-cart"></i> <i class="fas fa-shopping-cart"></i>
<span class="nav-link-text">{{ $__t('Stores') }}</span> <span class="nav-link-text">{{ $__t('Stores') }}</span>
</a> </a>
</li> </li>
@endif @endif
<li data-nav-for-page="quantityunits" data-sub-menu-of="#top-nav-manager-master-data"> <li data-nav-for-page="quantityunits"
<a class="nav-link discrete-link" href="{{ $U('/quantityunits') }}"> data-sub-menu-of="#top-nav-manager-master-data">
<a class="nav-link discrete-link"
href="{{ $U('/quantityunits') }}">
<i class="fas fa-balance-scale"></i> <i class="fas fa-balance-scale"></i>
<span class="nav-link-text">{{ $__t('Quantity units') }}</span> <span class="nav-link-text">{{ $__t('Quantity units') }}</span>
</a> </a>
</li> </li>
<li data-nav-for-page="productgroups" data-sub-menu-of="#top-nav-manager-master-data"> <li data-nav-for-page="productgroups"
<a class="nav-link discrete-link" href="{{ $U('/productgroups') }}"> data-sub-menu-of="#top-nav-manager-master-data">
<a class="nav-link discrete-link"
href="{{ $U('/productgroups') }}">
<i class="fas fa-object-group"></i> <i class="fas fa-object-group"></i>
<span class="nav-link-text">{{ $__t('Product groups') }}</span> <span class="nav-link-text">{{ $__t('Product groups') }}</span>
</a> </a>
</li> </li>
@endif @endif
@if(GROCY_FEATURE_FLAG_CHORES) @if(GROCY_FEATURE_FLAG_CHORES)
<li data-nav-for-page="chores" data-sub-menu-of="#top-nav-manager-master-data"> <li data-nav-for-page="chores"
<a class="nav-link discrete-link" href="{{ $U('/chores') }}"> data-sub-menu-of="#top-nav-manager-master-data">
<a class="nav-link discrete-link"
href="{{ $U('/chores') }}">
<i class="fas fa-home"></i> <i class="fas fa-home"></i>
<span class="nav-link-text">{{ $__t('Chores') }}</span> <span class="nav-link-text">{{ $__t('Chores') }}</span>
</a> </a>
</li> </li>
@endif @endif
@if(GROCY_FEATURE_FLAG_BATTERIES) @if(GROCY_FEATURE_FLAG_BATTERIES)
<li data-nav-for-page="batteries" data-sub-menu-of="#top-nav-manager-master-data"> <li data-nav-for-page="batteries"
<a class="nav-link discrete-link" href="{{ $U('/batteries') }}"> data-sub-menu-of="#top-nav-manager-master-data">
<a class="nav-link discrete-link"
href="{{ $U('/batteries') }}">
<i class="fas fa-battery-half"></i> <i class="fas fa-battery-half"></i>
<span class="nav-link-text">{{ $__t('Batteries') }}</span> <span class="nav-link-text">{{ $__t('Batteries') }}</span>
</a> </a>
</li> </li>
@endif @endif
@if(GROCY_FEATURE_FLAG_TASKS) @if(GROCY_FEATURE_FLAG_TASKS)
<li data-nav-for-page="taskcategories" data-sub-menu-of="#top-nav-manager-master-data"> <li data-nav-for-page="taskcategories"
<a class="nav-link discrete-link" href="{{ $U('/taskcategories') }}"> data-sub-menu-of="#top-nav-manager-master-data">
<a class="nav-link discrete-link"
href="{{ $U('/taskcategories') }}">
<i class="fas fa-project-diagram "></i> <i class="fas fa-project-diagram "></i>
<span class="nav-link-text">{{ $__t('Task categories') }}</span> <span class="nav-link-text">{{ $__t('Task categories') }}</span>
</a> </a>
</li> </li>
@endif @endif
<li data-nav-for-page="userfields" data-sub-menu-of="#top-nav-manager-master-data"> <li data-nav-for-page="userfields"
<a class="nav-link discrete-link" href="{{ $U('/userfields') }}"> data-sub-menu-of="#top-nav-manager-master-data">
<a class="nav-link discrete-link"
href="{{ $U('/userfields') }}">
<i class="fas fa-bookmark "></i> <i class="fas fa-bookmark "></i>
<span class="nav-link-text">{{ $__t('Userfields') }}</span> <span class="nav-link-text">{{ $__t('Userfields') }}</span>
</a> </a>
</li> </li>
<li data-nav-for-page="userentities" data-sub-menu-of="#top-nav-manager-master-data"> <li data-nav-for-page="userentities"
<a class="nav-link discrete-link" href="{{ $U('/userentities') }}"> data-sub-menu-of="#top-nav-manager-master-data">
<a class="nav-link discrete-link"
href="{{ $U('/userentities') }}">
<i class="fas fa-bookmark "></i> <i class="fas fa-bookmark "></i>
<span class="nav-link-text">{{ $__t('Userentities') }}</span> <span class="nav-link-text">{{ $__t('Userentities') }}</span>
</a> </a>
@@ -307,7 +461,8 @@
<ul class="navbar-nav sidenav-toggler"> <ul class="navbar-nav sidenav-toggler">
<li class="nav-item"> <li class="nav-item">
<a id="sidenavToggler" class="nav-link text-center"> <a id="sidenavToggler"
class="nav-link text-center">
<i class="fas fa-angle-left"></i> <i class="fas fa-angle-left"></i>
</a> </a>
</li> </li>
@@ -316,33 +471,47 @@
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">
@if(GROCY_AUTHENTICATED === true && !GROCY_IS_EMBEDDED_INSTALL && GROCY_SHOW_AUTH_VIEWS) @if(GROCY_AUTHENTICATED === true && !GROCY_IS_EMBEDDED_INSTALL && GROCY_SHOW_AUTH_VIEWS)
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle discrete-link" href="#" data-toggle="dropdown"><i class="fas fa-user"></i> {{ GROCY_USER_USERNAME }}</a> <a class="nav-link dropdown-toggle discrete-link"
href="#"
data-toggle="dropdown"><i class="fas fa-user"></i> {{ GROCY_USER_USERNAME }}</a>
<div class="dropdown-menu dropdown-menu-right"> <div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item logout-button discrete-link" href="{{ $U('/logout') }}"><i class="fas fa-sign-out-alt"></i>&nbsp;{{ $__t('Logout') }}</a> <a class="dropdown-item logout-button discrete-link"
href="{{ $U('/logout') }}"><i class="fas fa-sign-out-alt"></i>&nbsp;{{ $__t('Logout') }}</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item logout-button discrete-link" href="{{ $U('/user/' . GROCY_USER_ID . '?changepw=true') }}"><i class="fas fa-key"></i>&nbsp;{{ $__t('Change password') }}</a> <a class="dropdown-item logout-button discrete-link"
href="{{ $U('/user/' . GROCY_USER_ID . '?changepw=true') }}"><i class="fas fa-key"></i>&nbsp;{{ $__t('Change password') }}</a>
</div> </div>
</li> </li>
@endif @endif
@if(GROCY_AUTHENTICATED === true) @if(GROCY_AUTHENTICATED === true)
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle discrete-link" href="#" data-toggle="dropdown"><i class="fas fa-sliders-h"></i> <span class="d-inline d-lg-none">{{ $__t('View settings') }}</span></a> <a class="nav-link dropdown-toggle discrete-link"
href="#"
data-toggle="dropdown"><i class="fas fa-sliders-h"></i> <span class="d-inline d-lg-none">{{ $__t('View settings') }}</span></a>
<div class="dropdown-menu dropdown-menu-right"> <div class="dropdown-menu dropdown-menu-right">
<div class="dropdown-item"> <div class="dropdown-item">
<div class="form-check"> <div class="form-check">
<input class="form-check-input user-setting-control" type="checkbox" id="auto-reload-enabled" data-setting-key="auto_reload_on_db_change"> <input class="form-check-input user-setting-control"
<label class="form-check-label" for="auto-reload-enabled"> type="checkbox"
id="auto-reload-enabled"
data-setting-key="auto_reload_on_db_change">
<label class="form-check-label"
for="auto-reload-enabled">
{{ $__t('Auto reload on external changes') }} {{ $__t('Auto reload on external changes') }}
</label> </label>
</div> </div>
</div> </div>
<div class="dropdown-item"> <div class="dropdown-item">
<div class="form-check"> <div class="form-check">
<input class="form-check-input user-setting-control" type="checkbox" id="show-clock-in-header" data-setting-key="show_clock_in_header"> <input class="form-check-input user-setting-control"
<label class="form-check-label" for="show-clock-in-header"> type="checkbox"
id="show-clock-in-header"
data-setting-key="show_clock_in_header">
<label class="form-check-label"
for="show-clock-in-header">
{{ $__t('Show clock in header') }} {{ $__t('Show clock in header') }}
</label> </label>
</div> </div>
@@ -350,44 +519,77 @@
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="dropdown-item"> <div class="dropdown-item">
<div class="form-check"> <div class="form-check">
<input class="form-check-input user-setting-control" type="checkbox" id="night-mode-enabled" data-setting-key="night_mode_enabled"> <input class="form-check-input user-setting-control"
<label class="form-check-label" for="night-mode-enabled"> type="checkbox"
id="night-mode-enabled"
data-setting-key="night_mode_enabled">
<label class="form-check-label"
for="night-mode-enabled">
{{ $__t('Enable night mode') }} {{ $__t('Enable night mode') }}
</label> </label>
</div> </div>
</div> </div>
<div class="dropdown-item"> <div class="dropdown-item">
<div class="form-check"> <div class="form-check">
<input class="form-check-input user-setting-control" type="checkbox" id="auto-night-mode-enabled" data-setting-key="auto_night_mode_enabled"> <input class="form-check-input user-setting-control"
<label class="form-check-label" for="auto-night-mode-enabled"> type="checkbox"
id="auto-night-mode-enabled"
data-setting-key="auto_night_mode_enabled">
<label class="form-check-label"
for="auto-night-mode-enabled">
{{ $__t('Auto enable in time range') }} {{ $__t('Auto enable in time range') }}
</label> </label>
</div> </div>
<div class="form-inline"> <div class="form-inline">
<input type="text" class="form-control my-1 user-setting-control" readonly id="auto-night-mode-time-range-from" placeholder="{{ $__t('From') }} ({{ $__t('in format') }} HH:mm)" data-setting-key="auto_night_mode_time_range_from"> <input type="text"
<input type="text" class="form-control user-setting-control" readonly id="auto-night-mode-time-range-to" placeholder="{{ $__t('To') }} ({{ $__t('in format') }} HH:mm)" data-setting-key="auto_night_mode_time_range_to"> class="form-control my-1 user-setting-control"
readonly
id="auto-night-mode-time-range-from"
placeholder="{{ $__t('From') }} ({{ $__t('in format') }} HH:mm)"
data-setting-key="auto_night_mode_time_range_from">
<input type="text"
class="form-control user-setting-control"
readonly
id="auto-night-mode-time-range-to"
placeholder="{{ $__t('To') }} ({{ $__t('in format') }} HH:mm)"
data-setting-key="auto_night_mode_time_range_to">
</div> </div>
<div class="form-check mt-1"> <div class="form-check mt-1">
<input class="form-check-input user-setting-control" type="checkbox" id="auto-night-mode-time-range-goes-over-midgnight" data-setting-key="auto_night_mode_time_range_goes_over_midnight"> <input class="form-check-input user-setting-control"
<label class="form-check-label" for="auto-night-mode-time-range-goes-over-midgnight"> type="checkbox"
id="auto-night-mode-time-range-goes-over-midgnight"
data-setting-key="auto_night_mode_time_range_goes_over_midnight">
<label class="form-check-label"
for="auto-night-mode-time-range-goes-over-midgnight">
{{ $__t('Time range goes over midnight') }} {{ $__t('Time range goes over midnight') }}
</label> </label>
</div> </div>
<input class="form-check-input d-none user-setting-control" type="checkbox" id="currently-inside-night-mode-range" data-setting-key="currently_inside_night_mode_range"> <input class="form-check-input d-none user-setting-control"
type="checkbox"
id="currently-inside-night-mode-range"
data-setting-key="currently_inside_night_mode_range">
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="dropdown-item"> <div class="dropdown-item">
<div class="form-check"> <div class="form-check">
<input class="form-check-input user-setting-control" type="checkbox" id="keep_screen_on" data-setting-key="keep_screen_on"> <input class="form-check-input user-setting-control"
<label class="form-check-label" for="keep_screen_on"> type="checkbox"
id="keep_screen_on"
data-setting-key="keep_screen_on">
<label class="form-check-label"
for="keep_screen_on">
{{ $__t('Keep screen on') }} {{ $__t('Keep screen on') }}
</label> </label>
</div> </div>
</div> </div>
<div class="dropdown-item"> <div class="dropdown-item">
<div class="form-check"> <div class="form-check">
<input class="form-check-input user-setting-control" type="checkbox" id="keep_screen_on_when_fullscreen_card" data-setting-key="keep_screen_on_when_fullscreen_card"> <input class="form-check-input user-setting-control"
<label class="form-check-label" for="keep_screen_on_when_fullscreen_card"> type="checkbox"
id="keep_screen_on_when_fullscreen_card"
data-setting-key="keep_screen_on_when_fullscreen_card">
<label class="form-check-label"
for="keep_screen_on_when_fullscreen_card">
{{ $__t('Keep screen on while displaying a "fullscreen-card"') }} {{ $__t('Keep screen on while displaying a "fullscreen-card"') }}
</label> </label>
</div> </div>
@@ -397,38 +599,54 @@
@endif @endif
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle discrete-link" href="#" data-toggle="dropdown"><i class="fas fa-wrench"></i> <span class="d-inline d-lg-none">{{ $__t('Settings') }}</span></a> <a class="nav-link dropdown-toggle discrete-link"
href="#"
data-toggle="dropdown"><i class="fas fa-wrench"></i> <span class="d-inline d-lg-none">{{ $__t('Settings') }}</span></a>
<div class="dropdown-menu dropdown-menu-right"> <div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item discrete-link" href="{{ $U('/stocksettings') }}"><i class="fas fa-box"></i>&nbsp;{{ $__t('Stock settings') }}</a> <a class="dropdown-item discrete-link"
href="{{ $U('/stocksettings') }}"><i class="fas fa-box"></i>&nbsp;{{ $__t('Stock settings') }}</a>
@if(GROCY_FEATURE_FLAG_SHOPPINGLIST) @if(GROCY_FEATURE_FLAG_SHOPPINGLIST)
<a class="dropdown-item discrete-link permission-SHOPPINGLIST" href="{{ $U('/shoppinglistsettings') }}"><i class="fas fa-shopping-cart"></i>&nbsp;{{ $__t('Shopping list settings') }}</a> <a class="dropdown-item discrete-link permission-SHOPPINGLIST"
href="{{ $U('/shoppinglistsettings') }}"><i class="fas fa-shopping-cart"></i>&nbsp;{{ $__t('Shopping list settings') }}</a>
@endif @endif
@if(GROCY_FEATURE_FLAG_RECIPES) @if(GROCY_FEATURE_FLAG_RECIPES)
<a class="dropdown-item discrete-link permission-RECIPES" href="{{ $U('/recipessettings') }}"><i class="fas fa-cocktail"></i>&nbsp;{{ $__t('Recipes settings') }}</a> <a class="dropdown-item discrete-link permission-RECIPES"
href="{{ $U('/recipessettings') }}"><i class="fas fa-cocktail"></i>&nbsp;{{ $__t('Recipes settings') }}</a>
@endif @endif
@if(GROCY_FEATURE_FLAG_CHORES) @if(GROCY_FEATURE_FLAG_CHORES)
<a class="dropdown-item discrete-link permission-CHORES" href="{{ $U('/choressettings') }}"><i class="fas fa-home"></i>&nbsp;{{ $__t('Chores settings') }}</a> <a class="dropdown-item discrete-link permission-CHORES"
href="{{ $U('/choressettings') }}"><i class="fas fa-home"></i>&nbsp;{{ $__t('Chores settings') }}</a>
@endif @endif
@if(GROCY_FEATURE_FLAG_BATTERIES) @if(GROCY_FEATURE_FLAG_BATTERIES)
<a class="dropdown-item discrete-link permission-BATTERIES" href="{{ $U('/batteriessettings') }}"><i class="fas fa-battery-half"></i>&nbsp;{{ $__t('Batteries settings') }}</a> <a class="dropdown-item discrete-link permission-BATTERIES"
href="{{ $U('/batteriessettings') }}"><i class="fas fa-battery-half"></i>&nbsp;{{ $__t('Batteries settings') }}</a>
@endif @endif
@if(GROCY_FEATURE_FLAG_TASKS) @if(GROCY_FEATURE_FLAG_TASKS)
<a class="dropdown-item discrete-link permission-TASKS" href="{{ $U('/taskssettings') }}"><i class="fas fa-tasks"></i>&nbsp;{{ $__t('Tasks settings') }}</a> <a class="dropdown-item discrete-link permission-TASKS"
href="{{ $U('/taskssettings') }}"><i class="fas fa-tasks"></i>&nbsp;{{ $__t('Tasks settings') }}</a>
@endif @endif
<a data-href="{{ $U('/usersettings') }}" class="dropdown-item discrete-link link-return"> <a data-href="{{ $U('/usersettings') }}"
class="dropdown-item discrete-link link-return">
<i class="fas fa-user-cog"></i> {{ $__t('User settings') }} <i class="fas fa-user-cog"></i> {{ $__t('User settings') }}
</a> </a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@if(GROCY_SHOW_AUTH_VIEWS) @if(GROCY_SHOW_AUTH_VIEWS)
<a class="dropdown-item discrete-link permission-USERS_READ" href="{{ $U('/users') }}"><i class="fas fa-users"></i>&nbsp;{{ $__t('Manage users') }}</a> <a class="dropdown-item discrete-link permission-USERS_READ"
href="{{ $U('/users') }}"><i class="fas fa-users"></i>&nbsp;{{ $__t('Manage users') }}</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item discrete-link" href="{{ $U('/manageapikeys') }}"><i class="fas fa-handshake"></i>&nbsp;{{ $__t('Manage API keys') }}</a> <a class="dropdown-item discrete-link"
href="{{ $U('/manageapikeys') }}"><i class="fas fa-handshake"></i>&nbsp;{{ $__t('Manage API keys') }}</a>
@endif @endif
<a class="dropdown-item discrete-link" target="_blank" href="{{ $U('/api') }}"><i class="fas fa-book"></i>&nbsp;{{ $__t('REST API & data model documentation') }}</a> <a class="dropdown-item discrete-link"
<a class="dropdown-item discrete-link" href="{{ $U('/barcodescannertesting') }}"><i class="fas fa-barcode"></i>&nbsp;{{ $__t('Barcode scanner testing') }}</a> target="_blank"
href="{{ $U('/api') }}"><i class="fas fa-book"></i>&nbsp;{{ $__t('REST API & data model documentation') }}</a>
<a class="dropdown-item discrete-link"
href="{{ $U('/barcodescannertesting') }}"><i class="fas fa-barcode"></i>&nbsp;{{ $__t('Barcode scanner testing') }}</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a id="about-dialog-link" class="dropdown-item discrete-link" href="#"><i class="fas fa-info fa-fw"></i>&nbsp;{{ $__t('About grocy') }} (Version {{ $version }})</a> <a id="about-dialog-link"
class="dropdown-item discrete-link"
href="#"><i class="fas fa-info fa-fw"></i>&nbsp;{{ $__t('About grocy') }} (Version {{ $version }})</a>
</div> </div>
</li> </li>
</ul> </ul>
@@ -439,7 +657,8 @@
<div class="content-wrapper pt-0"> <div class="content-wrapper pt-0">
<div class="container-fluid pr-1 pl-md-3 pl-1"> <div class="container-fluid pr-1 pl-md-3 pl-1">
<div class="row mb-3"> <div class="row mb-3">
<div id="page-content" class="col content-text"> <div id="page-content"
class="col content-text">
@yield('content') @yield('content')
</div> </div>
</div> </div>
@@ -498,18 +717,18 @@
if (array_key_exists('componentScripts', $env)) if (array_key_exists('componentScripts', $env))
{ {
// Take every line into a new array, one element per line // Take every line into a new array, one element per line
$filteredStack = array_map(function($value) $filteredStack = array_map(function($value)
{ {
return explode("#SEP#", str_replace(array("\n", "\r", "\t"), '#SEP#', trim($value))); return explode("#SEP#", str_replace(array("\n", "\r", "\t"), '#SEP#', trim($value)));
}, $env['componentScripts']); }, $env['componentScripts']);
// Flatten the array into a single one, only keep unique lines, remove empty lines, add a defined new line // Flatten the array into a single one, only keep unique lines, remove empty lines, add a defined new line
$filteredStack = preg_filter('/$/', "\n", array_filter(array_unique(array_merge(...$filteredStack)))); $filteredStack = preg_filter('/$/', "\n", array_filter(array_unique(array_merge(...$filteredStack))));
// Write it back // Write it back
$env['componentScripts'] = $filteredStack; $env['componentScripts'] = $filteredStack;
$property->setValue($__env, $env); $property->setValue($__env, $env);
} }
@endphp @endphp
@@ -517,7 +736,7 @@
@hasSection('viewJsName')<script src="{{ $U('/viewjs', true) }}/@yield('viewJsName').js?v={{ $version }}"></script>@endif @hasSection('viewJsName')<script src="{{ $U('/viewjs', true) }}/@yield('viewJsName').js?v={{ $version }}"></script>@endif
@if(file_exists(GROCY_DATAPATH . '/custom_js.html')) @if(file_exists(GROCY_DATAPATH . '/custom_js.html'))
@php include GROCY_DATAPATH . '/custom_js.html' @endphp @php include GROCY_DATAPATH . '/custom_js.html' @endphp
@endif @endif
</body> </body>

View File

@@ -4,33 +4,34 @@
@section('viewJsName', 'locationcontentsheet') @section('viewJsName', 'locationcontentsheet')
@push('pageStyles') @push('pageStyles')
<style> <style>
@media print @media print {
{ .page:not(:last-child) {
.page:not(:last-child) { page-break-after: always !important;
page-break-after: always !important; }
}
.page.no-page-break { .page.no-page-break {
page-break-after: avoid !important; page-break-after: avoid !important;
} }
/* /*
Workaround because of Firefox bug Workaround because of Firefox bug
see https://github.com/twbs/bootstrap/issues/22753 see https://github.com/twbs/bootstrap/issues/22753
and https://bugzilla.mozilla.org/show_bug.cgi?id=1413121 and https://bugzilla.mozilla.org/show_bug.cgi?id=1413121
*/ */
.row { .row {
display: inline !important; display: inline !important;
}
} }
</style> }
</style>
@endpush @endpush
@section('content') @section('content')
<h1 class="d-print-none"> <h1 class="d-print-none">
@yield('title') @yield('title')
<a class="btn btn-outline-dark responsive-button print-all-locations-button" href="#"> <a class="btn btn-outline-dark responsive-button print-all-locations-button"
href="#">
<i class="fas fa-print"></i> {{ $__t('Print') . ' (' . $__t('all locations') . ')' }} <i class="fas fa-print"></i> {{ $__t('Print') . ' (' . $__t('all locations') . ')' }}
</a> </a>
</h1> </h1>
@@ -41,9 +42,12 @@
@foreach($locations as $location) @foreach($locations as $location)
<div class="page"> <div class="page">
<h1 class="text-center"> <h1 class="text-center">
<img src="{{ $U('/img/grocy_logo.svg?v=', true) }}{{ $version }}" height="30" class="d-none d-print-flex mx-auto"> <img src="{{ $U('/img/grocy_logo.svg?v=', true) }}{{ $version }}"
height="30"
class="d-none d-print-flex mx-auto">
{{ $location->name }} {{ $location->name }}
<a class="btn btn-outline-dark responsive-button print-single-location-button d-print-none" href="#"> <a class="btn btn-outline-dark responsive-button print-single-location-button d-print-none"
href="#">
<i class="fas fa-print"></i> {{ $__t('Print') . ' (' . $__t('this location') . ')' }} <i class="fas fa-print"></i> {{ $__t('Print') . ' (' . $__t('this location') . ')' }}
</a> </a>
</h1> </h1>

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit location')) @section('title', $__t('Edit location'))
@else @else
@section('title', $__t('Create location')) @section('title', $__t('Create location'))
@endif @endif
@section('viewJsName', 'locationform') @section('viewJsName', 'locationform')
@@ -17,45 +17,66 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<script>Grocy.EditMode = '{{ $mode }}';</script> <script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $location->id }};</script> <script>
Grocy.EditObjectId = {{ $location->id }};
</script>
@endif @endif
<form id="location-form" novalidate> <form id="location-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Name') }}</label> <label for="name">{{ $__t('Name') }}</label>
<input type="text" class="form-control" required id="name" name="name" value="@if($mode == 'edit'){{ $location->name }}@endif"> <input type="text"
class="form-control"
required
id="name"
name="name"
value="@if($mode == 'edit'){{ $location->name }}@endif">
<div class="invalid-feedback">{{ $__t('A name is required') }}</div> <div class="invalid-feedback">{{ $__t('A name is required') }}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="description">{{ $__t('Description') }}</label> <label for="description">{{ $__t('Description') }}</label>
<textarea class="form-control" rows="2" id="description" name="description">@if($mode == 'edit'){{ $location->description }}@endif</textarea> <textarea class="form-control"
rows="2"
id="description"
name="description">@if($mode == 'edit'){{ $location->description }}@endif</textarea>
</div> </div>
@if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_FREEZING) @if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_FREEZING)
<div class="form-group"> <div class="form-group">
<div class="form-check"> <div class="form-check">
<input type="hidden" name="is_freezer" value="0"> <input type="hidden"
<input @if($mode == 'edit' && $location->is_freezer == 1) checked @endif class="form-check-input" type="checkbox" id="is_freezer" name="is_freezer" value="1"> name="is_freezer"
<label class="form-check-label" for="is_freezer">{{ $__t('Is freezer') }} value="0">
<input @if($mode=='edit'
&&
$location->is_freezer == 1) checked @endif class="form-check-input" type="checkbox" id="is_freezer" name="is_freezer" value="1">
<label class="form-check-label"
for="is_freezer">{{ $__t('Is freezer') }}
<span class="text-muted small">{{ $__t('When moving products from/to a freezer location, the products best before date is automatically adjusted according to the product settings') }}</span> <span class="text-muted small">{{ $__t('When moving products from/to a freezer location, the products best before date is automatically adjusted according to the product settings') }}</span>
</label> </label>
</div> </div>
</div> </div>
@else @else
<input type="hidden" name="is_freezer" value="0"> <input type="hidden"
name="is_freezer"
value="0">
@endif @endif
@include('components.userfieldsform', array( @include('components.userfieldsform', array(
'userfields' => $userfields, 'userfields' => $userfields,
'entity' => 'locations' 'entity' => 'locations'
)) ))
<button id="save-location-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-location-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>

View File

@@ -10,7 +10,8 @@
<div class="title-related-links"> <div class="title-related-links">
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<div class="related-links"> <div class="related-links">
<a class="btn btn-outline-secondary" href="{{ $U('/userfields?entity=locations') }}"> <a class="btn btn-outline-secondary"
href="{{ $U('/userfields?entity=locations') }}">
{{ $__t('Configure userfields') }} {{ $__t('Configure userfields') }}
</a> </a>
</div> </div>
@@ -20,7 +21,8 @@
<hr> <hr>
<div class="row mt-3"> <div class="row mt-3">
<div class="col-xs-12 col-md-2 col-xl-1"> <div class="col-xs-12 col-md-2 col-xl-1">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3" href="{{ $U('/location/new') }}"> <a class="btn btn-primary btn-sm responsive-button w-100 mb-3"
href="{{ $U('/location/new') }}">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
@@ -29,16 +31,20 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="locations-table" class="table table-sm table-striped dt-responsive"> <table id="locations-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -46,7 +52,7 @@
<th>{{ $__t('Description') }}</th> <th>{{ $__t('Description') }}</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
@@ -55,10 +61,14 @@
@foreach($locations as $location) @foreach($locations as $location)
<tr> <tr>
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-info btn-sm" href="{{ $U('/location/') }}{{ $location->id }}"> <a class="btn btn-info btn-sm"
href="{{ $U('/location/') }}{{ $location->id }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-danger btn-sm location-delete-button" href="#" data-location-id="{{ $location->id }}" data-location-name="{{ $location->name }}"> <a class="btn btn-danger btn-sm location-delete-button"
href="#"
data-location-id="{{ $location->id }}"
data-location-name="{{ $location->name }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
</td> </td>
@@ -70,8 +80,8 @@
</td> </td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $location->id) 'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $location->id)
)) ))
</tr> </tr>

View File

@@ -8,27 +8,42 @@
<div class="col-lg-6 offset-lg-3 col-xs-12"> <div class="col-lg-6 offset-lg-3 col-xs-12">
<h2 class="text-center">@yield('title')</h2> <h2 class="text-center">@yield('title')</h2>
<hr> <hr>
<form method="post" action="{{ $U('/login') }}" id="login-form" novalidate> <form method="post"
action="{{ $U('/login') }}"
id="login-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Username') }}</label> <label for="name">{{ $__t('Username') }}</label>
<input type="text" class="form-control" required id="username" name="username"> <input type="text"
class="form-control"
required
id="username"
name="username">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Password') }}</label> <label for="name">{{ $__t('Password') }}</label>
<input type="password" class="form-control" required id="password" name="password"> <input type="password"
<div id="login-error" class="form-text text-danger d-none"></div> class="form-control"
required
id="password"
name="password">
<div id="login-error"
class="form-text text-danger d-none"></div>
</div> </div>
<div class="checkbox"> <div class="checkbox">
<label for="stay_logged_in"> <label for="stay_logged_in">
<input type="checkbox" id="stay_logged_in" name="stay_logged_in"> {{ $__t('Stay logged in permanently') }} <input type="checkbox"
id="stay_logged_in"
name="stay_logged_in"> {{ $__t('Stay logged in permanently') }}
<p class="form-text text-muted small my-0">{{ $__t('When not set, you will get logged out at latest after 30 days') }}</p> <p class="form-text text-muted small my-0">{{ $__t('When not set, you will get logged out at latest after 30 days') }}</p>
</label> </label>
</div> </div>
<button id="login-button" class="btn btn-success">{{ $__t('OK') }}</button> <button id="login-button"
class="btn btn-success">{{ $__t('OK') }}</button>
</form> </form>
</div> </div>

View File

@@ -5,7 +5,8 @@
@section('viewJsName', 'manageapikeys') @section('viewJsName', 'manageapikeys')
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
@endpush @endpush
@section('content') @section('content')
@@ -17,7 +18,8 @@
<hr> <hr>
<div class="row mt-3"> <div class="row mt-3">
<div class="col-xs-12 col-md-2 col-xl-1"> <div class="col-xs-12 col-md-2 col-xl-1">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3" href="{{ $U('/manageapikeys/new') }}"> <a class="btn btn-primary btn-sm responsive-button w-100 mb-3"
href="{{ $U('/manageapikeys/new') }}">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
@@ -26,16 +28,20 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="apikeys-table" class="table table-sm table-striped dt-responsive"> <table id="apikeys-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -51,7 +57,10 @@
@foreach($apiKeys as $apiKey) @foreach($apiKeys as $apiKey)
<tr id="apiKeyRow_{{ $apiKey->id }}"> <tr id="apiKeyRow_{{ $apiKey->id }}">
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-danger btn-sm apikey-delete-button" href="#" data-apikey-id="{{ $apiKey->id }}" data-apikey-apikey="{{ $apiKey->api_key }}"> <a class="btn btn-danger btn-sm apikey-delete-button"
href="#"
data-apikey-id="{{ $apiKey->id }}"
data-apikey-apikey="{{ $apiKey->api_key }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
</td> </td>
@@ -63,15 +72,18 @@
</td> </td>
<td> <td>
{{ $apiKey->expires }} {{ $apiKey->expires }}
<time class="timeago timeago-contextual" datetime="{{ $apiKey->expires }}"></time> <time class="timeago timeago-contextual"
datetime="{{ $apiKey->expires }}"></time>
</td> </td>
<td> <td>
@if(empty($apiKey->last_used)){{ $__t('never') }}@else{{ $apiKey->last_used }}@endif @if(empty($apiKey->last_used)){{ $__t('never') }}@else{{ $apiKey->last_used }}@endif
<time class="timeago timeago-contextual" datetime="{{ $apiKey->last_used }}"></time> <time class="timeago timeago-contextual"
datetime="{{ $apiKey->last_used }}"></time>
</td> </td>
<td> <td>
{{ $apiKey->row_created_timestamp }} {{ $apiKey->row_created_timestamp }}
<time class="timeago timeago-contextual" datetime="{{ $apiKey->row_created_timestamp }}"></time> <time class="timeago timeago-contextual"
datetime="{{ $apiKey->row_created_timestamp }}"></time>
</td> </td>
<td> <td>
{{ $apiKey->key_type }} {{ $apiKey->key_type }}

View File

@@ -5,12 +5,13 @@
@section('viewJsName', 'mealplan') @section('viewJsName', 'mealplan')
@push('pageScripts') @push('pageScripts')
<script src="{{ $U('/node_modules/fullcalendar/dist/fullcalendar.min.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/node_modules/fullcalendar/dist/fullcalendar.min.js?v=', true) }}{{ $version }}"></script>
@if(!empty($__t('fullcalendar_locale') && $__t('fullcalendar_locale') != 'x'))<script src="{{ $U('/node_modules', true) }}/fullcalendar/dist/locale/{{ $__t('fullcalendar_locale') }}.js?v={{ $version }}"></script>@endif @if(!empty($__t('fullcalendar_locale') && $__t('fullcalendar_locale') != 'x'))<script src="{{ $U('/node_modules', true) }}/fullcalendar/dist/locale/{{ $__t('fullcalendar_locale') }}.js?v={{ $version }}"></script>@endif
@endpush @endpush
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/fullcalendar/dist/fullcalendar.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/fullcalendar/dist/fullcalendar.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
@endpush @endpush
@section('content') @section('content')
@@ -38,94 +39,130 @@
</div> </div>
</div> </div>
<div class="modal fade" id="add-recipe-modal" tabindex="-1"> <div class="modal fade"
id="add-recipe-modal"
tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 id="add-recipe-modal-title" class="modal-title w-100"></h4> <h4 id="add-recipe-modal-title"
class="modal-title w-100"></h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form id="add-recipe-form" novalidate> <form id="add-recipe-form"
novalidate>
@include('components.recipepicker', array( @include('components.recipepicker', array(
'recipes' => $recipes, 'recipes' => $recipes,
'isRequired' => true, 'isRequired' => true,
'nextInputSelector' => '#recipe_servings' 'nextInputSelector' => '#recipe_servings'
)) ))
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'recipe_servings', 'id' => 'recipe_servings',
'label' => 'Servings', 'label' => 'Servings',
'min' => 1, 'min' => 1,
'value' => '1', 'value' => '1',
'invalidFeedback' => $__t('This cannot be lower than %s', '1') 'invalidFeedback' => $__t('This cannot be lower than %s', '1')
)) ))
<input type="hidden" id="day" name="day" value=""> <input type="hidden"
<input type="hidden" name="type" value="recipe"> id="day"
name="day"
value="">
<input type="hidden"
name="type"
value="recipe">
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ $__t('Cancel') }}</button> <button type="button"
<button id="save-add-recipe-button" data-dismiss="modal" class="btn btn-success">{{ $__t('Save') }}</button> class="btn btn-secondary"
data-dismiss="modal">{{ $__t('Cancel') }}</button>
<button id="save-add-recipe-button"
data-dismiss="modal"
class="btn btn-success">{{ $__t('Save') }}</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="add-note-modal" tabindex="-1"> <div class="modal fade"
id="add-note-modal"
tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 id="add-note-modal-title" class="modal-title w-100"></h4> <h4 id="add-note-modal-title"
class="modal-title w-100"></h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form id="add-note-form" novalidate> <form id="add-note-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="note">{{ $__t('Note') }}</label> <label for="note">{{ $__t('Note') }}</label>
<textarea class="form-control" rows="2" id="note" name="note"></textarea> <textarea class="form-control"
rows="2"
id="note"
name="note"></textarea>
</div> </div>
<input type="hidden" name="type" value="note"> <input type="hidden"
name="type"
value="note">
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ $__t('Cancel') }}</button> <button type="button"
<button id="save-add-note-button" data-dismiss="modal" class="btn btn-success">{{ $__t('Save') }}</button> class="btn btn-secondary"
data-dismiss="modal">{{ $__t('Cancel') }}</button>
<button id="save-add-note-button"
data-dismiss="modal"
class="btn btn-success">{{ $__t('Save') }}</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="add-product-modal" tabindex="-1"> <div class="modal fade"
id="add-product-modal"
tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 id="add-product-modal-title" class="modal-title w-100"></h4> <h4 id="add-product-modal-title"
class="modal-title w-100"></h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form id="add-product-form" novalidate> <form id="add-product-form"
novalidate>
@include('components.productpicker', array( @include('components.productpicker', array(
'products' => $products, 'products' => $products,
'nextInputSelector' => '#amount' 'nextInputSelector' => '#amount'
)) ))
@include('components.productamountpicker', array( @include('components.productamountpicker', array(
'value' => 1, 'value' => 1,
'additionalGroupCssClasses' => 'mb-0' 'additionalGroupCssClasses' => 'mb-0'
)) ))
<input type="hidden" name="type" value="product"> <input type="hidden"
name="type"
value="product">
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ $__t('Cancel') }}</button> <button type="button"
<button id="save-add-product-button" data-dismiss="modal" class="btn btn-success">{{ $__t('Save') }}</button> class="btn btn-secondary"
data-dismiss="modal">{{ $__t('Cancel') }}</button>
<button id="save-add-product-button"
data-dismiss="modal"
class="btn btn-success">{{ $__t('Save') }}</button>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,22 +1,30 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge"> <meta http-equiv="x-ua-compatible"
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> content="ie=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="robots" content="noindex,nofollow"> <meta name="robots"
<meta name="format-detection" content="telephone=no"> content="noindex,nofollow">
<meta name="format-detection"
content="telephone=no">
<meta name="author" content="Bernd Bestel (bernd@berrnd.de)"> <meta name="author"
<link rel="icon" href="{{ $U('/img/grocy_icon.svg?v=', true) }}{{ $version }}"> content="Bernd Bestel (bernd@berrnd.de)">
<link rel="icon"
href="{{ $U('/img/grocy_icon.svg?v=', true) }}{{ $version }}">
<title>{{ $__t('REST API & data model documentation') }} | grocy</title> <title>{{ $__t('REST API & data model documentation') }} | grocy</title>
<link href="{{ $U('/node_modules/swagger-ui-dist/swagger-ui.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/swagger-ui-dist/swagger-ui.css?v=', true) }}{{ $version }}"
rel="stylesheet">
@if(file_exists(GROCY_DATAPATH . '/custom_css.html')) @if(file_exists(GROCY_DATAPATH . '/custom_css.html'))
@php include GROCY_DATAPATH . '/custom_css.html' @endphp @php include GROCY_DATAPATH . '/custom_css.html' @endphp
@endif @endif
<script> <script>
@@ -45,6 +53,7 @@
-webkit-box-shadow: none !important; -webkit-box-shadow: none !important;
border-bottom: 1px solid rgba(59, 65, 81, 0.3) !important; border-bottom: 1px solid rgba(59, 65, 81, 0.3) !important;
} }
</style> </style>
</head> </head>
@@ -57,7 +66,8 @@
<script src="{{ $U('/viewjs', true) }}/openapiui.js?v={{ $version }}"></script> <script src="{{ $U('/viewjs', true) }}/openapiui.js?v={{ $version }}"></script>
@if(file_exists(GROCY_DATAPATH . '/custom_js.html')) @if(file_exists(GROCY_DATAPATH . '/custom_js.html'))
@php include GROCY_DATAPATH . '/custom_js.html' @endphp @php include GROCY_DATAPATH . '/custom_js.html' @endphp
@endif @endif
</body> </body>
</html> </html>

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit Barcode')) @section('title', $__t('Edit Barcode'))
@else @else
@section('title', $__t('Create Barcode')) @section('title', $__t('Create Barcode'))
@endif @endif
@section('viewJsName', 'productbarcodesform') @section('viewJsName', 'productbarcodesform')
@@ -20,50 +20,71 @@
<h3 class="text-muted">{{ $__t('Barcode for product') }} <strong>{{ $product->name }}</strong></h3> <h3 class="text-muted">{{ $__t('Barcode for product') }} <strong>{{ $product->name }}</strong></h3>
<script>Grocy.EditMode = '{{ $mode }}';</script> <script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $barcode->id }};</script> <script>
Grocy.EditObjectId = {{ $barcode->id }};
</script>
@endif @endif
<form id="barcode-form" novalidate> <form id="barcode-form"
novalidate>
<input type="hidden" name="product_id" value="{{ $product->id }}"> <input type="hidden"
name="product_id"
value="{{ $product->id }}">
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Barcode') }}<i class="fas fa-barcode"></i></label> <label for="name">{{ $__t('Barcode') }}<i class="fas fa-barcode"></i></label>
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control barcodescanner-input" required id="barcode" name="barcode" value="@if($mode == 'edit'){{ $barcode->barcode }}@endif" data-target="#scanned_barcode"> <input type="text"
class="form-control barcodescanner-input"
required
id="barcode"
name="barcode"
value="@if($mode == 'edit'){{ $barcode->barcode }}@endif"
data-target="#scanned_barcode">
@include('components.barcodescanner') @include('components.barcodescanner')
</div> </div>
</div> </div>
@php if($mode == 'edit') { $value = $barcode->qu_factor_purchase_to_stock; } else { $value = 1; } @endphp @php if($mode == 'edit') { $value = $barcode->qu_factor_purchase_to_stock; } else { $value = 1; } @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'qu_factor_purchase_to_stock', 'id' => 'qu_factor_purchase_to_stock',
'label' => 'Factor purchase to stock quantity unit', 'label' => 'Factor purchase to stock quantity unit',
'min' => 1, 'min' => 1,
'value' => $value, 'value' => $value,
'isRequired' => true, 'isRequired' => true,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'), 'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
'additionalCssClasses' => 'input-group-qu', 'additionalCssClasses' => 'input-group-qu',
)) ))
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
<div class="form-group"> <div class="form-group">
<label for="shopping_location_id_id">{{ $__t('Default store') }}</label> <label for="shopping_location_id_id">{{ $__t('Default store') }}</label>
<select class="form-control" id="shopping_location_id" name="shopping_location_id"> <select class="form-control"
id="shopping_location_id"
name="shopping_location_id">
<option></option> <option></option>
@foreach($shoppinglocations as $store) @foreach($shoppinglocations as $store)
<option @if($mode == 'edit' && $store->id == $product->shopping_location_id) selected="selected" @endif value="{{ $store->id }}">{{ $store->name }}</option> <option @if($mode=='edit'
&&
$store->id == $product->shopping_location_id) selected="selected" @endif value="{{ $store->id }}">{{ $store->name }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
@else @else
<input type="hidden" name="shopping_location_id" id="shopping_location_id" value="1"> <input type="hidden"
name="shopping_location_id"
id="shopping_location_id"
value="1">
@endif @endif
<button id="save-barcode-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-barcode-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>

View File

@@ -1,22 +1,24 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit product')) @section('title', $__t('Edit product'))
@else @else
@section('title', $__t('Create product')) @section('title', $__t('Create product'))
@endif @endif
@section('viewJsName', 'productform') @section('viewJsName', 'productform')
@push('pageScripts') @push('pageScripts')
<script src="{{ $U('/node_modules/TagManager/tagmanager.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/node_modules/TagManager/tagmanager.js?v=', true) }}{{ $version }}"></script>
<script src="{{ $U('/node_modules/datatables.net-rowgroup/js/dataTables.rowGroup.min.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/node_modules/datatables.net-rowgroup/js/dataTables.rowGroup.min.js?v=', true) }}{{ $version }}"></script>
<script src="{{ $U('/node_modules/datatables.net-rowgroup-bs4/js/rowGroup.bootstrap4.min.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/node_modules/datatables.net-rowgroup-bs4/js/rowGroup.bootstrap4.min.js?v=', true) }}{{ $version }}"></script>
@endpush @endpush
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/TagManager/tagmanager.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/TagManager/tagmanager.css?v=', true) }}{{ $version }}"
<link href="{{ $U('/node_modules/datatables.net-rowgroup-bs4/css/rowGroup.bootstrap4.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> rel="stylesheet">
<link href="{{ $U('/node_modules/datatables.net-rowgroup-bs4/css/rowGroup.bootstrap4.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
@endpush @endpush
@section('content') @section('content')
@@ -28,96 +30,134 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<script>Grocy.EditMode = '{{ $mode }}';</script> <script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $product->id }};</script> <script>
Grocy.EditObjectId = {{ $product->id }};
</script>
@if(!empty($product->picture_file_name)) @if(!empty($product->picture_file_name))
<script>Grocy.ProductPictureFileName = '{{ $product->picture_file_name }}';</script> <script>
@endif Grocy.ProductPictureFileName = '{{ $product->picture_file_name }}';
</script>
@endif
@endif @endif
<form id="product-form" novalidate> <form id="product-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Name') }}</label> <label for="name">{{ $__t('Name') }}</label>
<input type="text" class="form-control" required id="name" name="name" value="@if($mode == 'edit'){{ $product->name}}@endif"> <input type="text"
class="form-control"
required
id="name"
name="name"
value="@if($mode == 'edit'){{ $product->name}}@endif">
<div class="invalid-feedback">{{ $__t('A name is required') }}</div> <div class="invalid-feedback">{{ $__t('A name is required') }}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="form-check"> <div class="form-check">
<input type="hidden" name="active" value="1"> <input type="hidden"
<input @if($mode == 'create') checked @elseif($mode == 'edit' && $product->active == 1) checked @endif class="form-check-input" type="checkbox" id="active" name="active" value="1"> name="active"
<label class="form-check-label" for="active">{{ $__t('Active') }}</label> value="1">
<input @if($mode=='create'
)
checked
@elseif($mode=='edit'
&&
$product->active == 1) checked @endif class="form-check-input" type="checkbox" id="active" name="active" value="1">
<label class="form-check-label"
for="active">{{ $__t('Active') }}</label>
</div> </div>
</div> </div>
@php $prefillById = ''; if($mode=='edit') { $prefillById = $product->parent_product_id; } @endphp @php $prefillById = ''; if($mode=='edit') { $prefillById = $product->parent_product_id; } @endphp
@php @php
$hint = ''; $hint = '';
if ($isSubProductOfOthers) if ($isSubProductOfOthers)
{ {
$hint = $__t('Not possible because this product is already used as a parent product in another product'); $hint = $__t('Not possible because this product is already used as a parent product in another product');
} }
@endphp @endphp
@include('components.productpicker', array( @include('components.productpicker', array(
'products' => $products, 'products' => $products,
'prefillById' => $prefillById, 'prefillById' => $prefillById,
'disallowAllProductWorkflows' => true, 'disallowAllProductWorkflows' => true,
'isRequired' => false, 'isRequired' => false,
'label' => 'Parent product', 'label' => 'Parent product',
'disabled' => $isSubProductOfOthers, 'disabled' => $isSubProductOfOthers,
'hint' => $hint 'hint' => $hint
)) ))
<div class="form-group"> <div class="form-group">
<label for="description">{{ $__t('Description') }}</label> <label for="description">{{ $__t('Description') }}</label>
<textarea class="form-control wysiwyg-editor" id="description" name="description">@if($mode == 'edit'){{ $product->description }}@endif</textarea> <textarea class="form-control wysiwyg-editor"
id="description"
name="description">@if($mode == 'edit'){{ $product->description }}@endif</textarea>
</div> </div>
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
<div class="form-group"> <div class="form-group">
<label for="location_id">{{ $__t('Default location') }}</label> <label for="location_id">{{ $__t('Default location') }}</label>
<select required class="form-control" id="location_id" name="location_id"> <select required
class="form-control"
id="location_id"
name="location_id">
<option></option> <option></option>
@foreach($locations as $location) @foreach($locations as $location)
<option @if($mode == 'edit' && $location->id == $product->location_id) selected="selected" @endif value="{{ $location->id }}">{{ $location->name }}</option> <option @if($mode=='edit'
&&
$location->id == $product->location_id) selected="selected" @endif value="{{ $location->id }}">{{ $location->name }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('A location is required') }}</div> <div class="invalid-feedback">{{ $__t('A location is required') }}</div>
</div> </div>
@else @else
<input type="hidden" name="location_id" id="location_id" value="1"> <input type="hidden"
name="location_id"
id="location_id"
value="1">
@endif @endif
@php $prefillById = ''; if($mode=='edit') { $prefillById = $product->shopping_location_id; } @endphp @php $prefillById = ''; if($mode=='edit') { $prefillById = $product->shopping_location_id; } @endphp
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
@include('components.shoppinglocationpicker', array( @include('components.shoppinglocationpicker', array(
'label' => 'Default store', 'label' => 'Default store',
'prefillById' => $prefillById, 'prefillById' => $prefillById,
'shoppinglocations' => $shoppinglocations 'shoppinglocations' => $shoppinglocations
)) ))
@else @else
<input type="hidden" name="shopping_location_id" id="shopping_location_id" value="1"> <input type="hidden"
name="shopping_location_id"
id="shopping_location_id"
value="1">
@endif @endif
@php if($mode == 'edit') { $value = $product->min_stock_amount; } else { $value = 0; } @endphp @php if($mode == 'edit') { $value = $product->min_stock_amount; } else { $value = 0; } @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'min_stock_amount', 'id' => 'min_stock_amount',
'label' => 'Minimum stock amount', 'label' => 'Minimum stock amount',
'min' => 0, 'min' => 0,
'value' => $value, 'value' => $value,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '0'), 'invalidFeedback' => $__t('The amount cannot be lower than %s', '0'),
'additionalGroupCssClasses' => 'mb-1' 'additionalGroupCssClasses' => 'mb-1'
)) ))
<div class="form-group"> <div class="form-group">
<div class="form-check"> <div class="form-check">
<input type="hidden" name="cumulate_min_stock_amount_of_sub_products" value="0"> <input type="hidden"
<input @if($mode == 'edit' && $product->cumulate_min_stock_amount_of_sub_products == 1) checked @endif class="form-check-input" type="checkbox" id="cumulate_min_stock_amount_of_sub_products" name="cumulate_min_stock_amount_of_sub_products" value="1"> name="cumulate_min_stock_amount_of_sub_products"
<label class="form-check-label" for="cumulate_min_stock_amount_of_sub_products">{{ $__t('Accumulate sub products min. stock amount') }} value="0">
<input @if($mode=='edit'
&&
$product->cumulate_min_stock_amount_of_sub_products == 1) checked @endif class="form-check-input" type="checkbox" id="cumulate_min_stock_amount_of_sub_products" name="cumulate_min_stock_amount_of_sub_products" value="1">
<label class="form-check-label"
for="cumulate_min_stock_amount_of_sub_products">{{ $__t('Accumulate sub products min. stock amount') }}
<span class="text-muted small">{{ $__t('If enabled, the min. stock amount of sub products will be accumulated into this product, means the sub product will never be "missing", only this product') }}</span> <span class="text-muted small">{{ $__t('If enabled, the min. stock amount of sub products will be accumulated into this product, means the sub product will never be "missing", only this product') }}</span>
</label> </label>
</div> </div>
@@ -126,43 +166,52 @@
@if(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
@php if($mode == 'edit') { $value = $product->default_best_before_days; } else { $value = 0; } @endphp @php if($mode == 'edit') { $value = $product->default_best_before_days; } else { $value = 0; } @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'default_best_before_days', 'id' => 'default_best_before_days',
'label' => 'Default best before days', 'label' => 'Default best before days',
'min' => -1, 'min' => -1,
'value' => $value, 'value' => $value,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '-1'), 'invalidFeedback' => $__t('The amount cannot be lower than %s', '-1'),
'hint' => $__t('For purchases this amount of days will be added to today for the best before date suggestion') . ' (' . $__t('-1 means that this product never expires') . ')' 'hint' => $__t('For purchases this amount of days will be added to today for the best before date suggestion') . ' (' . $__t('-1 means that this product never expires') . ')'
)) ))
@if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING)
@php if($mode == 'edit') { $value = $product->default_best_before_days_after_open; } else { $value = 0; } @endphp @php if($mode == 'edit') { $value = $product->default_best_before_days_after_open; } else { $value = 0; } @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'default_best_before_days_after_open', 'id' => 'default_best_before_days_after_open',
'label' => 'Default best before days after opened', 'label' => 'Default best before days after opened',
'min' => 0, 'min' => 0,
'value' => $value, 'value' => $value,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '-1'), 'invalidFeedback' => $__t('The amount cannot be lower than %s', '-1'),
'hint' => $__t('When this product was marked as opened, the best before date will be replaced by today + this amount of days (a value of 0 disables this)') 'hint' => $__t('When this product was marked as opened, the best before date will be replaced by today + this amount of days (a value of 0 disables this)')
)) ))
@endif @endif
@endif @endif
<div class="form-group"> <div class="form-group">
<label for="product_group_id">{{ $__t('Product group') }}</label> <label for="product_group_id">{{ $__t('Product group') }}</label>
<select class="form-control" id="product_group_id" name="product_group_id"> <select class="form-control"
id="product_group_id"
name="product_group_id">
<option></option> <option></option>
@foreach($productgroups as $productgroup) @foreach($productgroups as $productgroup)
<option @if($mode == 'edit' && $productgroup->id == $product->product_group_id) selected="selected" @endif value="{{ $productgroup->id }}">{{ $productgroup->name }}</option> <option @if($mode=='edit'
&&
$productgroup->id == $product->product_group_id) selected="selected" @endif value="{{ $productgroup->id }}">{{ $productgroup->name }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="qu_id_purchase">{{ $__t('Quantity unit purchase') }}</label> <label for="qu_id_purchase">{{ $__t('Quantity unit purchase') }}</label>
<select required class="form-control input-group-qu" id="qu_id_purchase" name="qu_id_purchase"> <select required
class="form-control input-group-qu"
id="qu_id_purchase"
name="qu_id_purchase">
<option></option> <option></option>
@foreach($quantityunits as $quantityunit) @foreach($quantityunits as $quantityunit)
<option @if($mode == 'edit' && $quantityunit->id == $product->qu_id_purchase) selected="selected" @endif value="{{ $quantityunit->id }}">{{ $quantityunit->name }}</option> <option @if($mode=='edit'
&&
$quantityunit->id == $product->qu_id_purchase) selected="selected" @endif value="{{ $quantityunit->id }}">{{ $quantityunit->name }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('A quantity unit is required') }}</div> <div class="invalid-feedback">{{ $__t('A quantity unit is required') }}</div>
@@ -170,11 +219,22 @@
<div class="form-group"> <div class="form-group">
<label for="qu_id_stock">{{ $__t('Quantity unit stock') }}</label> <label for="qu_id_stock">{{ $__t('Quantity unit stock') }}</label>
<i class="fas fa-question-circle" data-toggle="tooltip" title="{{ $__t('Quantity unit stock cannot be changed after first purchase') }}"></i> <i class="fas fa-question-circle"
<select required class="form-control input-group-qu" id="qu_id_stock" name="qu_id_stock" @if($mode == 'edit') disabled @endif> data-toggle="tooltip"
title="{{ $__t('Quantity unit stock cannot be changed after first purchase') }}"></i>
<select required
class="form-control input-group-qu"
id="qu_id_stock"
name="qu_id_stock"
@if($mode=='edit'
)
disabled
@endif>
<option></option> <option></option>
@foreach($quantityunits as $quantityunit) @foreach($quantityunits as $quantityunit)
<option @if($mode == 'edit' && $quantityunit->id == $product->qu_id_stock) selected="selected" @endif value="{{ $quantityunit->id }}" data-plural-form="{{ $quantityunit->name_plural }}">{{ $quantityunit->name }}</option> <option @if($mode=='edit'
&&
$quantityunit->id == $product->qu_id_stock) selected="selected" @endif value="{{ $quantityunit->id }}" data-plural-form="{{ $quantityunit->name_plural }}">{{ $quantityunit->name }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('A quantity unit is required') }}</div> <div class="invalid-feedback">{{ $__t('A quantity unit is required') }}</div>
@@ -182,28 +242,39 @@
@php if($mode == 'edit') { $value = $product->qu_factor_purchase_to_stock; } else { $value = 1; } @endphp @php if($mode == 'edit') { $value = $product->qu_factor_purchase_to_stock; } else { $value = 1; } @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'qu_factor_purchase_to_stock', 'id' => 'qu_factor_purchase_to_stock',
'label' => 'Factor purchase to stock quantity unit', 'label' => 'Factor purchase to stock quantity unit',
'min' => 1, 'min' => 1,
'value' => $value, 'value' => $value,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'), 'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
'additionalCssClasses' => 'input-group-qu', 'additionalCssClasses' => 'input-group-qu',
'additionalHtmlElements' => '<p id="qu-conversion-info" class="form-text text-muted small d-none"></p>' 'additionalHtmlElements' => '<p id="qu-conversion-info"
class="form-text text-muted small d-none"></p>'
)) ))
<div class="form-group"> <div class="form-group">
<div class="form-check"> <div class="form-check">
<input type="hidden" name="allow_partial_units_in_stock" value="0"> <input type="hidden"
<input @if($mode == 'edit' && $product->allow_partial_units_in_stock == 1) checked @endif class="form-check-input" type="checkbox" id="allow_partial_units_in_stock" name="allow_partial_units_in_stock" value="1"> name="allow_partial_units_in_stock"
<label class="form-check-label" for="allow_partial_units_in_stock">{{ $__t('Allow partial units in stock') }}</label> value="0">
<input @if($mode=='edit'
&&
$product->allow_partial_units_in_stock == 1) checked @endif class="form-check-input" type="checkbox" id="allow_partial_units_in_stock" name="allow_partial_units_in_stock" value="1">
<label class="form-check-label"
for="allow_partial_units_in_stock">{{ $__t('Allow partial units in stock') }}</label>
</div> </div>
</div> </div>
<div class="form-group mb-1"> <div class="form-group mb-1">
<div class="form-check"> <div class="form-check">
<input type="hidden" name="enable_tare_weight_handling" value="0"> <input type="hidden"
<input @if($mode == 'edit' && $product->enable_tare_weight_handling == 1) checked @endif class="form-check-input" type="checkbox" id="enable_tare_weight_handling" name="enable_tare_weight_handling" value="1"> name="enable_tare_weight_handling"
<label class="form-check-label" for="enable_tare_weight_handling">{{ $__t('Enable tare weight handling') }} value="0">
<input @if($mode=='edit'
&&
$product->enable_tare_weight_handling == 1) checked @endif class="form-check-input" type="checkbox" id="enable_tare_weight_handling" name="enable_tare_weight_handling" value="1">
<label class="form-check-label"
for="enable_tare_weight_handling">{{ $__t('Enable tare weight handling') }}
<span class="text-muted small">{{ $__t('This is useful e.g. for flour in jars - on purchase/consume/inventory you always weigh the whole jar, the amount to be posted is then automatically calculated based on what is in stock and the tare weight defined below') }}</span> <span class="text-muted small">{{ $__t('This is useful e.g. for flour in jars - on purchase/consume/inventory you always weigh the whole jar, the amount to be posted is then automatically calculated based on what is in stock and the tare weight defined below') }}</span>
</label> </label>
</div> </div>
@@ -212,23 +283,28 @@
@php if($mode == 'edit') { $value = $product->tare_weight; } else { $value = 0; } @endphp @php if($mode == 'edit') { $value = $product->tare_weight; } else { $value = 0; } @endphp
@php if(($mode == 'edit' && $product->enable_tare_weight_handling == 0) || $mode == 'create') { $additionalAttributes = 'disabled'; } else { $additionalAttributes = ''; } @endphp @php if(($mode == 'edit' && $product->enable_tare_weight_handling == 0) || $mode == 'create') { $additionalAttributes = 'disabled'; } else { $additionalAttributes = ''; } @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'tare_weight', 'id' => 'tare_weight',
'label' => 'Tare weight', 'label' => 'Tare weight',
'min' => 0, 'min' => 0,
'step' => 0.01, 'step' => 0.01,
'value' => $value, 'value' => $value,
'invalidFeedback' => $__t('This cannot be lower than %s', '0'), 'invalidFeedback' => $__t('This cannot be lower than %s', '0'),
'additionalAttributes' => $additionalAttributes, 'additionalAttributes' => $additionalAttributes,
'hintId' => 'tare_weight_qu_info' 'hintId' => 'tare_weight_qu_info'
)) ))
@php $additionalAttributes = '' @endphp @php $additionalAttributes = '' @endphp
@if(GROCY_FEATURE_FLAG_RECIPES) @if(GROCY_FEATURE_FLAG_RECIPES)
<div class="form-group"> <div class="form-group">
<div class="form-check"> <div class="form-check">
<input type="hidden" name="not_check_stock_fulfillment_for_recipes" value="0"> <input type="hidden"
<input @if($mode == 'edit' && $product->not_check_stock_fulfillment_for_recipes == 1) checked @endif class="form-check-input" type="checkbox" id="not_check_stock_fulfillment_for_recipes" name="not_check_stock_fulfillment_for_recipes" value="1"> name="not_check_stock_fulfillment_for_recipes"
<label class="form-check-label" for="not_check_stock_fulfillment_for_recipes">{{ $__t('Disable stock fulfillment checking for this ingredient') }} value="0">
<input @if($mode=='edit'
&&
$product->not_check_stock_fulfillment_for_recipes == 1) checked @endif class="form-check-input" type="checkbox" id="not_check_stock_fulfillment_for_recipes" name="not_check_stock_fulfillment_for_recipes" value="1">
<label class="form-check-label"
for="not_check_stock_fulfillment_for_recipes">{{ $__t('Disable stock fulfillment checking for this ingredient') }}
<span class="text-muted small">{{ $__t('This will be used as the default setting when adding this product as a recipe ingredient') }}</span> <span class="text-muted small">{{ $__t('This will be used as the default setting when adding this product as a recipe ingredient') }}</span>
</label> </label>
</div> </div>
@@ -236,40 +312,44 @@
@php if($mode == 'edit') { $value = $product->calories; } else { $value = 0; } @endphp @php if($mode == 'edit') { $value = $product->calories; } else { $value = 0; } @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'calories', 'id' => 'calories',
'label' => 'Energy (kcal)', 'label' => 'Energy (kcal)',
'min' => 0, 'min' => 0,
'step' => 0.01, 'step' => 0.01,
'value' => $value, 'value' => $value,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '0'), 'invalidFeedback' => $__t('The amount cannot be lower than %s', '0'),
'hint' => $__t('Per stock quantity unit'), 'hint' => $__t('Per stock quantity unit'),
'isRequired' => false 'isRequired' => false
)) ))
@endif @endif
@if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_FREEZING) @if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_FREEZING)
@php if($mode == 'edit') { $value = $product->default_best_before_days_after_freezing; } else { $value = 0; } @endphp @php if($mode == 'edit') { $value = $product->default_best_before_days_after_freezing; } else { $value = 0; } @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'default_best_before_days_after_freezing', 'id' => 'default_best_before_days_after_freezing',
'label' => 'Default best before days after freezing', 'label' => 'Default best before days after freezing',
'min' => -1, 'min' => -1,
'value' => $value, 'value' => $value,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '0'), 'invalidFeedback' => $__t('The amount cannot be lower than %s', '0'),
'hint' => $__t('On moving this product to a freezer location (so when freezing it), the best before date will be replaced by today + this amount of days') 'hint' => $__t('On moving this product to a freezer location (so when freezing it), the best before date will be replaced by today + this amount of days')
)) ))
@php if($mode == 'edit') { $value = $product->default_best_before_days_after_thawing; } else { $value = 0; } @endphp @php if($mode == 'edit') { $value = $product->default_best_before_days_after_thawing; } else { $value = 0; } @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'default_best_before_days_after_thawing', 'id' => 'default_best_before_days_after_thawing',
'label' => 'Default best before days after thawing', 'label' => 'Default best before days after thawing',
'min' => -1, 'min' => -1,
'value' => $value, 'value' => $value,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '0'), 'invalidFeedback' => $__t('The amount cannot be lower than %s', '0'),
'hint' => $__t('On moving this product from a freezer location (so when thawing it), the best before date will be replaced by today + this amount of days') 'hint' => $__t('On moving this product from a freezer location (so when thawing it), the best before date will be replaced by today + this amount of days')
)) ))
@else @else
<input type="hidden" name="default_best_before_days_after_freezing" value="0"> <input type="hidden"
<input type="hidden" name="default_best_before_days_after_thawing" value="0"> name="default_best_before_days_after_freezing"
value="0">
<input type="hidden"
name="default_best_before_days_after_thawing"
value="0">
@endif @endif
<div class="form-group"> <div class="form-group">
@@ -277,17 +357,22 @@
<span class="text-muted small">{{ $__t('If you don\'t select a file, the current picture will not be altered') }}</span> <span class="text-muted small">{{ $__t('If you don\'t select a file, the current picture will not be altered') }}</span>
</label> </label>
<div class="custom-file"> <div class="custom-file">
<input type="file" class="custom-file-input" id="product-picture" accept="image/*"> <input type="file"
<label class="custom-file-label" for="product-picture">{{ $__t('No file selected') }}</label> class="custom-file-input"
id="product-picture"
accept="image/*">
<label class="custom-file-label"
for="product-picture">{{ $__t('No file selected') }}</label>
</div> </div>
</div> </div>
@include('components.userfieldsform', array( @include('components.userfieldsform', array(
'userfields' => $userfields, 'userfields' => $userfields,
'entity' => 'products' 'entity' => 'products'
)) ))
<button id="save-product-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-product-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>
@@ -295,12 +380,16 @@
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<h2> <h2>
{{ $__t('QU conversions') }} {{ $__t('QU conversions') }}
<a class="btn btn-outline-dark show-as-dialog-link" type="button" href="{{ $U('/quantityunitconversion/new?embedded&product=' . $product->id ) }}"> <a class="btn btn-outline-dark show-as-dialog-link"
type="button"
href="{{ $U('/quantityunitconversion/new?embedded&product=' . $product->id ) }}">
<i class="fas fa-plus"></i> {{ $__t('Add') }} <i class="fas fa-plus"></i> {{ $__t('Add') }}
</a> </a>
</h2> </h2>
<h5 id="qu-conversion-headline-info" class="text-muted font-italic"></h5> <h5 id="qu-conversion-headline-info"
<table id="qu-conversions-table" class="table table-sm table-striped dt-responsive"> class="text-muted font-italic"></h5>
<table id="qu-conversions-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -313,34 +402,37 @@
<tbody class="d-none"> <tbody class="d-none">
@if($mode == "edit") @if($mode == "edit")
@foreach($quConversions as $quConversion) @foreach($quConversions as $quConversion)
@if($quConversion->product_id == $product->id || $quConversion->product_id == null) @if($quConversion->product_id == $product->id || $quConversion->product_id == null)
<tr> <tr>
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-sm btn-info show-as-dialog-link @if($quConversion->product_id == null) disabled @endif" href="{{ $U('/quantityunitconversion/' . $quConversion->id . '?embedded&product=' . $product->id ) }}"> <a class="btn btn-sm btn-info show-as-dialog-link @if($quConversion->product_id == null) disabled @endif"
<i class="fas fa-edit"></i> href="{{ $U('/quantityunitconversion/' . $quConversion->id . '?embedded&product=' . $product->id ) }}">
</a> <i class="fas fa-edit"></i>
<a class="btn btn-sm btn-danger qu-conversion-delete-button @if($quConversion->product_id == null) disabled @endif" href="#" data-qu-conversion-id="{{ $quConversion->id }}"> </a>
<i class="fas fa-trash"></i> <a class="btn btn-sm btn-danger qu-conversion-delete-button @if($quConversion->product_id == null) disabled @endif"
</a> href="#"
</td> data-qu-conversion-id="{{ $quConversion->id }}">
<td> <i class="fas fa-trash"></i>
<span class="locale-number locale-number-quantity-amount">{{ $quConversion->factor }}</span> </a>
</td> </td>
<td> <td>
{{ FindObjectInArrayByPropertyValue($quantityunits, 'id', $quConversion->to_qu_id)->name }} <span class="locale-number locale-number-quantity-amount">{{ $quConversion->factor }}</span>
</td> </td>
<td class="d-none"> <td>
@if($quConversion->product_id != null) {{ FindObjectInArrayByPropertyValue($quantityunits, 'id', $quConversion->to_qu_id)->name }}
{{ $__t('Product overrides') }} </td>
@else <td class="d-none">
{{ $__t('Default conversions') }} @if($quConversion->product_id != null)
@endif {{ $__t('Product overrides') }}
</td> @else
<td class="d-none"> {{ $__t('Default conversions') }}
from_qu_id xx{{ $quConversion->from_qu_id }}xx @endif
</td> </td>
</tr> <td class="d-none">
@endif from_qu_id xx{{ $quConversion->from_qu_id }}xx
</td>
</tr>
@endif
@endforeach @endforeach
@endif @endif
</tbody> </tbody>
@@ -348,12 +440,16 @@
<h2> <h2>
{{ $__t('Barcodes') }} {{ $__t('Barcodes') }}
<a class="btn btn-outline-dark show-as-dialog-link" type="button" href="{{ $U('/productbarcodes/new?embedded&product=' . $product->id ) }}"> <a class="btn btn-outline-dark show-as-dialog-link"
type="button"
href="{{ $U('/productbarcodes/new?embedded&product=' . $product->id ) }}">
<i class="fas fa-plus"></i> {{ $__t('Add') }} <i class="fas fa-plus"></i> {{ $__t('Add') }}
</a> </a>
</h2> </h2>
<h5 id="barcode-headline-info" class="text-muted font-italic"></h5> <h5 id="barcode-headline-info"
<table id="barcode-table" class="table table-sm table-striped dt-responsive"> class="text-muted font-italic"></h5>
<table id="barcode-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -365,31 +461,37 @@
<tbody class="d-none"> <tbody class="d-none">
@if($mode == "edit") @if($mode == "edit")
@foreach($barcodes as $barcode) @foreach($barcodes as $barcode)
@if($barcode->product_id == $product->id || $barcode->product_id == null) @if($barcode->product_id == $product->id || $barcode->product_id == null)
<tr> <tr>
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-sm btn-info show-as-dialog-link @if($barcode->product_id == null) disabled @endif" href="{{ $U('/productbarcodes/' . $barcode->id . '?embedded&product=' . $product->id ) }}"> <a class="btn btn-sm btn-info show-as-dialog-link @if($barcode->product_id == null) disabled @endif"
<i class="fas fa-edit"></i> href="{{ $U('/productbarcodes/' . $barcode->id . '?embedded&product=' . $product->id ) }}">
</a> <i class="fas fa-edit"></i>
<a class="btn btn-sm btn-danger barcode-delete-button @if($barcode->product_id == null) disabled @endif" href="#" data-barcode-id="{{ $barcode->id }}" data-barcode="{{ $barcode->barcode }}" data-product-barcode="{{ $product->barcode }}" data-product-id="{{ $product->id }}"> </a>
<i class="fas fa-trash"></i> <a class="btn btn-sm btn-danger barcode-delete-button @if($barcode->product_id == null) disabled @endif"
</a> href="#"
</td> data-barcode-id="{{ $barcode->id }}"
<td> data-barcode="{{ $barcode->barcode }}"
{{ $barcode->barcode }} data-product-barcode="{{ $product->barcode }}"
</td> data-product-id="{{ $product->id }}">
<td> <i class="fas fa-trash"></i>
<span class="locale-number locale-number-quantity-amount">{{ $barcode->qu_factor_purchase_to_stock }}</span> </a>
</td> </td>
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) <td>
<td id="barcode-shopping-location"> {{ $barcode->barcode }}
@if (FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $barcode->shopping_location_id) !== null) </td>
{{ FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $barcode->shopping_location_id)->name }} <td>
@endif <span class="locale-number locale-number-quantity-amount">{{ $barcode->qu_factor_purchase_to_stock }}</span>
</td> </td>
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
<td id="barcode-shopping-location">
@if (FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $barcode->shopping_location_id) !== null)
{{ FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $barcode->shopping_location_id)->name }}
@endif @endif
</tr> </td>
@endif @endif
</tr>
@endif
@endforeach @endforeach
@endif @endif
</tbody> </tbody>
@@ -397,12 +499,17 @@
<div class="pt-5"> <div class="pt-5">
<label class="mt-2">{{ $__t('Picture') }}</label> <label class="mt-2">{{ $__t('Picture') }}</label>
<button id="delete-current-product-picture-button" class="btn btn-sm btn-danger @if(empty($product->picture_file_name)) disabled @endif"><i class="fas fa-trash"></i> {{ $__t('Delete') }}</button> <button id="delete-current-product-picture-button"
class="btn btn-sm btn-danger @if(empty($product->picture_file_name)) disabled @endif"><i class="fas fa-trash"></i> {{ $__t('Delete') }}</button>
@if(!empty($product->picture_file_name)) @if(!empty($product->picture_file_name))
<p><img id="current-product-picture" data-src="{{ $U('/api/files/productpictures/' . base64_encode($product->picture_file_name) . '?force_serve_as=picture&best_fit_width=400') }}" class="img-fluid img-thumbnail mt-2 lazy"></p> <p><img id="current-product-picture"
<p id="delete-current-product-picture-on-save-hint" class="form-text text-muted font-italic d-none">{{ $__t('The current picture will be deleted when you save the product') }}</p> data-src="{{ $U('/api/files/productpictures/' . base64_encode($product->picture_file_name) . '?force_serve_as=picture&best_fit_width=400') }}"
class="img-fluid img-thumbnail mt-2 lazy"></p>
<p id="delete-current-product-picture-on-save-hint"
class="form-text text-muted font-italic d-none">{{ $__t('The current picture will be deleted when you save the product') }}</p>
@else @else
<p id="no-current-product-picture-hint" class="form-text text-muted font-italic">{{ $__t('No picture available') }}</p> <p id="no-current-product-picture-hint"
class="form-text text-muted font-italic">{{ $__t('No picture available') }}</p>
@endif @endif
</div> </div>
</div> </div>

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit product group')) @section('title', $__t('Edit product group'))
@else @else
@section('title', $__t('Create product group')) @section('title', $__t('Create product group'))
@endif @endif
@section('viewJsName', 'productgroupform') @section('viewJsName', 'productgroupform')
@@ -17,31 +17,45 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<script>Grocy.EditMode = '{{ $mode }}';</script> <script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $group->id }};</script> <script>
Grocy.EditObjectId = {{ $group->id }};
</script>
@endif @endif
<form id="product-group-form" novalidate> <form id="product-group-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Name') }}</label> <label for="name">{{ $__t('Name') }}</label>
<input type="text" class="form-control" required id="name" name="name" value="@if($mode == 'edit'){{ $group->name }}@endif"> <input type="text"
class="form-control"
required
id="name"
name="name"
value="@if($mode == 'edit'){{ $group->name }}@endif">
<div class="invalid-feedback">{{ $__t('A name is required') }}</div> <div class="invalid-feedback">{{ $__t('A name is required') }}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="description">{{ $__t('Description') }}</label> <label for="description">{{ $__t('Description') }}</label>
<textarea class="form-control" rows="2" id="description" name="description">@if($mode == 'edit'){{ $group->description }}@endif</textarea> <textarea class="form-control"
rows="2"
id="description"
name="description">@if($mode == 'edit'){{ $group->description }}@endif</textarea>
</div> </div>
@include('components.userfieldsform', array( @include('components.userfieldsform', array(
'userfields' => $userfields, 'userfields' => $userfields,
'entity' => 'product_groups' 'entity' => 'product_groups'
)) ))
<button id="save-product-group-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-product-group-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>

View File

@@ -10,7 +10,8 @@
<div class="title-related-links"> <div class="title-related-links">
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<div class="related-links"> <div class="related-links">
<a class="btn btn-outline-secondary" href="{{ $U('/userfields?entity=product_groups') }}"> <a class="btn btn-outline-secondary"
href="{{ $U('/userfields?entity=product_groups') }}">
{{ $__t('Configure userfields') }} {{ $__t('Configure userfields') }}
</a> </a>
</div> </div>
@@ -20,7 +21,8 @@
<hr> <hr>
<div class="row mt-3"> <div class="row mt-3">
<div class="col-xs-12 col-md-2 col-xl-1"> <div class="col-xs-12 col-md-2 col-xl-1">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3 show-as-dialog-link" href="{{ $U('/productgroup/new?embedded') }}"> <a class="btn btn-primary btn-sm responsive-button w-100 mb-3 show-as-dialog-link"
href="{{ $U('/productgroup/new?embedded') }}">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
@@ -29,16 +31,20 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="productgroups-table" class="table table-sm table-striped dt-responsive"> <table id="productgroups-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -47,7 +53,7 @@
<th>{{ $__t('Product count') }}</th> <th>{{ $__t('Product count') }}</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
</thead> </thead>
@@ -55,10 +61,14 @@
@foreach($productGroups as $productGroup) @foreach($productGroups as $productGroup)
<tr> <tr>
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-info btn-sm show-as-dialog-link" href="{{ $U('/productgroup/') }}{{ $productGroup->id }}?embedded"> <a class="btn btn-info btn-sm show-as-dialog-link"
href="{{ $U('/productgroup/') }}{{ $productGroup->id }}?embedded">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-danger btn-sm product-group-delete-button" href="#" data-group-id="{{ $productGroup->id }}" data-group-name="{{ $productGroup->name }}"> <a class="btn btn-danger btn-sm product-group-delete-button"
href="#"
data-group-id="{{ $productGroup->id }}"
data-group-name="{{ $productGroup->name }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
</td> </td>
@@ -70,14 +80,15 @@
</td> </td>
<td> <td>
{{ count(FindAllObjectsInArrayByPropertyValue($products, 'product_group_id', $productGroup->id)) }} {{ count(FindAllObjectsInArrayByPropertyValue($products, 'product_group_id', $productGroup->id)) }}
<a class="btn btn-link btn-sm text-body" href="{{ $U('/products?product-group=') . $productGroup->id }}"> <a class="btn btn-link btn-sm text-body"
<i class="fas fa-external-link-alt"></i> href="{{ $U('/products?product-group=') . $productGroup->id }}">
<i class="fas fa-external-link-alt"></i>
</a> </a>
</td> </td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $productGroup->id) 'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $productGroup->id)
)) ))
</tr> </tr>

View File

@@ -10,10 +10,12 @@
<div class="title-related-links"> <div class="title-related-links">
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<div class="related-links"> <div class="related-links">
<a class="btn btn-outline-secondary mb-1" href="{{ $U('/userfields?entity=products') }}"> <a class="btn btn-outline-secondary mb-1"
href="{{ $U('/userfields?entity=products') }}">
{{ $__t('Configure userfields') }} {{ $__t('Configure userfields') }}
</a> </a>
<a class="btn btn-outline-secondary mb-1" href="{{ $U('/stocksettings#productpresets') }}"> <a class="btn btn-outline-secondary mb-1"
href="{{ $U('/stocksettings#productpresets') }}">
{{ $__t('Presets for new products') }} {{ $__t('Presets for new products') }}
</a> </a>
</div> </div>
@@ -24,7 +26,8 @@
<div class="row mt-3"> <div class="row mt-3">
<div class="col-xs-12 col-md-2 col-xl-1"> <div class="col-xs-12 col-md-2 col-xl-1">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3" href="{{ $U('/product/new') }}"> <a class="btn btn-primary btn-sm responsive-button w-100 mb-3"
href="{{ $U('/product/new') }}">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
@@ -33,20 +36,24 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-filter"></i></span> <span class="input-group-text"><i class="fas fa-filter"></i></span>
</div> </div>
<select class="form-control" id="location-filter"> <select class="form-control"
id="location-filter">
<option value="all">{{ $__t('All') }}</option> <option value="all">{{ $__t('All') }}</option>
@foreach($productGroups as $productGroup) @foreach($productGroups as $productGroup)
<option value="{{ $productGroup->id }}">{{ $productGroup->name }}</option> <option value="{{ $productGroup->id }}">{{ $productGroup->name }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
@@ -55,7 +62,8 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="products-table" class="table table-sm table-striped dt-responsive"> <table id="products-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -69,7 +77,7 @@
<th>{{ $__t('Barcode(s)') }}</th> <th>{{ $__t('Barcode(s)') }}</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
@@ -78,10 +86,14 @@
@foreach($products as $product) @foreach($products as $product)
<tr> <tr>
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-info btn-sm" href="{{ $U('/product/') }}{{ $product->id }}"> <a class="btn btn-info btn-sm"
href="{{ $U('/product/') }}{{ $product->id }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-danger btn-sm product-delete-button @if($product->active == 0) disabled @endif" href="#" data-product-id="{{ $product->id }}" data-product-name="{{ $product->name }}"> <a class="btn btn-danger btn-sm product-delete-button @if($product->active == 0) disabled @endif"
href="#"
data-product-id="{{ $product->id }}"
data-product-name="{{ $product->name }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
</td> </td>
@@ -111,8 +123,8 @@
</td> </td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $product->id) 'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $product->id)
)) ))
</tr> </tr>

View File

@@ -5,7 +5,7 @@
@section('viewJsName', 'purchase') @section('viewJsName', 'purchase')
@push('pageScripts') @push('pageScripts')
<script src="{{ $U('/js/grocy_uisound.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/js/grocy_uisound.js?v=', true) }}{{ $version }}"></script>
@endpush @endpush
@section('content') @section('content')
@@ -15,8 +15,16 @@
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<div class="related-links"> <div class="related-links">
@if(!$embedded) @if(!$embedded)
<button id="scan-mode-button" class="btn @if(boolval($userSettings['scan_mode_purchase_enabled'])) btn-success @else btn-danger @endif" type="checkbox">{{ $__t('Scan mode') }} <span id="scan-mode-status">@if(boolval($userSettings['scan_mode_purchase_enabled'])) {{ $__t('on') }} @else {{ $__t('off') }} @endif</span></button> <button id="scan-mode-button"
<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> class="btn @if(boolval($userSettings['scan_mode_purchase_enabled'])) btn-success @else btn-danger @endif"
type="checkbox">{{ $__t('Scan mode') }} <span id="scan-mode-status">@if(boolval($userSettings['scan_mode_purchase_enabled'])) {{ $__t('on') }} @else {{ $__t('off') }} @endif</span></button>
<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>
@else @else
<script> <script>
Grocy.UserSettings.scan_mode_purchase_enabled = false; Grocy.UserSettings.scan_mode_purchase_enabled = false;
@@ -26,95 +34,113 @@
</div> </div>
<hr> <hr>
<form id="purchase-form" novalidate> <form id="purchase-form"
novalidate>
@include('components.productpicker', array( @include('components.productpicker', array(
'products' => $products, 'products' => $products,
'barcodes' => $barcodes, 'barcodes' => $barcodes,
'nextInputSelector' => '#amount' 'nextInputSelector' => '#amount'
)) ))
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'amount', 'id' => 'amount',
'label' => 'Amount', 'label' => 'Amount',
'hintId' => 'amount_qu_unit', 'hintId' => 'amount_qu_unit',
'min' => 1, 'min' => 1,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'), 'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
'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>' '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>'
)) ))
@php @php
$additionalGroupCssClasses = ''; $additionalGroupCssClasses = '';
if (!GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) if (!GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
{ {
$additionalGroupCssClasses = 'd-none'; $additionalGroupCssClasses = 'd-none';
} }
@endphp @endphp
@include('components.datetimepicker', array( @include('components.datetimepicker', array(
'id' => 'best_before_date', 'id' => 'best_before_date',
'label' => 'Best before', 'label' => 'Best before',
'format' => 'YYYY-MM-DD', 'format' => 'YYYY-MM-DD',
'initWithNow' => false, 'initWithNow' => false,
'limitEndToNow' => false, 'limitEndToNow' => false,
'limitStartToNow' => false, 'limitStartToNow' => false,
'invalidFeedback' => $__t('A best before date is required'), 'invalidFeedback' => $__t('A best before date is required'),
'nextInputSelector' => '#price', 'nextInputSelector' => '#price',
'additionalCssClasses' => 'date-only-datetimepicker', 'additionalCssClasses' => 'date-only-datetimepicker',
'shortcutValue' => '2999-12-31', 'shortcutValue' => '2999-12-31',
'shortcutLabel' => 'Never expires', 'shortcutLabel' => 'Never expires',
'earlierThanInfoLimit' => date('Y-m-d'), 'earlierThanInfoLimit' => date('Y-m-d'),
'earlierThanInfoText' => $__t('The given date is earlier than today, are you sure?'), 'earlierThanInfoText' => $__t('The given date is earlier than today, are you sure?'),
'additionalGroupCssClasses' => $additionalGroupCssClasses, 'additionalGroupCssClasses' => $additionalGroupCssClasses,
'activateNumberPad' => GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD 'activateNumberPad' => GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD
)) ))
@php $additionalGroupCssClasses = ''; @endphp @php $additionalGroupCssClasses = ''; @endphp
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'price', 'id' => 'price',
'label' => 'Price', 'label' => 'Price',
'min' => 0, 'min' => 0,
'step' => 0.01, 'step' => 0.01,
'value' => '', 'value' => '',
'hintId' => 'price-hint', 'hintId' => 'price-hint',
'invalidFeedback' => $__t('The price cannot be lower than %s', '0'), 'invalidFeedback' => $__t('The price cannot be lower than %s', '0'),
'isRequired' => false, 'isRequired' => false,
'additionalGroupCssClasses' => 'mb-1' 'additionalGroupCssClasses' => 'mb-1'
)) ))
<div class="form-check form-check-inline mb-3"> <div class="form-check form-check-inline mb-3">
<input class="form-check-input" type="radio" name="price-type" id="price-type-unit-price" value="unit-price" checked> <input class="form-check-input"
<label class="form-check-label" for="price-type-unit-price">{{ $__t('Price') }}</label> type="radio"
name="price-type"
id="price-type-unit-price"
value="unit-price"
checked>
<label class="form-check-label"
for="price-type-unit-price">{{ $__t('Price') }}</label>
</div> </div>
<div class="form-check form-check-inline mb-3"> <div class="form-check form-check-inline mb-3">
<input class="form-check-input" type="radio" name="price-type" id="price-type-total-price" value="total-price"> <input class="form-check-input"
<label class="form-check-label" for="price-type-total-price">{{ $__t('Total price') }}</label> type="radio"
name="price-type"
id="price-type-total-price"
value="total-price">
<label class="form-check-label"
for="price-type-total-price">{{ $__t('Total price') }}</label>
</div> </div>
@include('components.shoppinglocationpicker', array( @include('components.shoppinglocationpicker', array(
'label' => 'Store', 'label' => 'Store',
'shoppinglocations' => $shoppinglocations 'shoppinglocations' => $shoppinglocations
)) ))
@else @else
<input type="hidden" name="price" id="price" value="0"> <input type="hidden"
name="price"
id="price"
value="0">
@endif @endif
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'qu_factor_purchase_to_stock', 'id' => 'qu_factor_purchase_to_stock',
'label' => 'Factor purchase to stock quantity unit', 'label' => 'Factor purchase to stock quantity unit',
'min' => 1, 'min' => 1,
'additionalGroupCssClasses' => 'd-none', 'additionalGroupCssClasses' => 'd-none',
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'), 'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
'additionalCssClasses' => 'input-group-qu', 'additionalCssClasses' => 'input-group-qu',
'additionalHtmlElements' => '<p id="qu-conversion-info" class="form-text text-muted small d-none"></p>' 'additionalHtmlElements' => '<p id="qu-conversion-info"
class="form-text text-muted small d-none"></p>'
)) ))
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
@include('components.locationpicker', array( @include('components.locationpicker', array(
'locations' => $locations, 'locations' => $locations,
'isRequired' => false 'isRequired' => false
)) ))
@endif @endif
<button id="save-purchase-button" class="btn btn-success d-block">{{ $__t('OK') }}</button> <button id="save-purchase-button"
class="btn btn-success d-block">{{ $__t('OK') }}</button>
</form> </form>
</div> </div>

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit QU conversion')) @section('title', $__t('Edit QU conversion'))
@else @else
@section('title', $__t('Create QU conversion')) @section('title', $__t('Create QU conversion'))
@endif @endif
@section('viewJsName', 'quantityunitconversionform') @section('viewJsName', 'quantityunitconversionform')
@@ -24,24 +24,38 @@
<h3 class="text-muted">{{ $__t('Default for QU') }} <strong>{{ $defaultQuUnit->name }}</strong></h3> <h3 class="text-muted">{{ $__t('Default for QU') }} <strong>{{ $defaultQuUnit->name }}</strong></h3>
@endif @endif
<script>Grocy.EditMode = '{{ $mode }}';</script> <script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $quConversion->id }};</script> <script>
Grocy.EditObjectId = {{ $quConversion->id }};
</script>
@endif @endif
<form id="quconversion-form" novalidate> <form id="quconversion-form"
novalidate>
@if($product != null) @if($product != null)
<input type="hidden" name="product_id" value="{{ $product->id }}"> <input type="hidden"
name="product_id"
value="{{ $product->id }}">
@endif @endif
<div class="form-group"> <div class="form-group">
<label for="from_qu_id">{{ $__t('Quantity unit from') }}</label> <label for="from_qu_id">{{ $__t('Quantity unit from') }}</label>
<select required disabled class="form-control input-group-qu" id="from_qu_id" name="from_qu_id"> <select required
disabled
class="form-control input-group-qu"
id="from_qu_id"
name="from_qu_id">
<option></option> <option></option>
@foreach($quantityunits as $quantityunit) @foreach($quantityunits as $quantityunit)
<option @if(($product != null && $quantityunit->id == $product->qu_id_stock) || ($defaultQuUnit != null && $quantityunit->id == $defaultQuUnit->id))) selected="selected" @endif value="{{ $quantityunit->id }}" data-plural-form="{{ $quantityunit->name_plural }}">{{ $quantityunit->name }}</option> <option @if(($product
!=null
&&
$quantityunit->id == $product->qu_id_stock) || ($defaultQuUnit != null && $quantityunit->id == $defaultQuUnit->id))) selected="selected" @endif value="{{ $quantityunit->id }}" data-plural-form="{{ $quantityunit->name_plural }}">{{ $quantityunit->name }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('A quantity unit is required') }}</div> <div class="invalid-feedback">{{ $__t('A quantity unit is required') }}</div>
@@ -49,10 +63,15 @@
<div class="form-group"> <div class="form-group">
<label for="to_qu_id">{{ $__t('Quantity unit to') }}</label> <label for="to_qu_id">{{ $__t('Quantity unit to') }}</label>
<select required class="form-control input-group-qu" id="to_qu_id" name="to_qu_id"> <select required
class="form-control input-group-qu"
id="to_qu_id"
name="to_qu_id">
<option></option> <option></option>
@foreach($quantityunits as $quantityunit) @foreach($quantityunits as $quantityunit)
<option @if($mode == 'edit' && $quantityunit->id == $quConversion->to_qu_id) selected="selected" @endif value="{{ $quantityunit->id }}" data-plural-form="{{ $quantityunit->name_plural }}">{{ $quantityunit->name }}</option> <option @if($mode=='edit'
&&
$quantityunit->id == $quConversion->to_qu_id) selected="selected" @endif value="{{ $quantityunit->id }}" data-plural-form="{{ $quantityunit->name_plural }}">{{ $quantityunit->name }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('A quantity unit is required') }}</div> <div class="invalid-feedback">{{ $__t('A quantity unit is required') }}</div>
@@ -60,29 +79,35 @@
@php if($mode == 'edit') { $value = $quConversion->factor; } else { $value = 1; } @endphp @php if($mode == 'edit') { $value = $quConversion->factor; } else { $value = 1; } @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'factor', 'id' => 'factor',
'label' => 'Factor', 'label' => 'Factor',
'min' => 0, 'min' => 0,
'step' => 0.001, 'step' => 0.001,
'value' => $value, 'value' => $value,
'invalidFeedback' => $__t('This cannot be lower than %1$s and must be a valid number with max. %2$s decimal places', '0', '3'), 'invalidFeedback' => $__t('This cannot be lower than %1$s and must be a valid number with max. %2$s decimal places', '0', '3'),
'additionalHtmlElements' => '<p id="qu-conversion-info" class="form-text text-info d-none"></p>', 'additionalHtmlElements' => '<p id="qu-conversion-info"
'additionalCssClasses' => 'input-group-qu' class="form-text text-info d-none"></p>',
'additionalCssClasses' => 'input-group-qu'
)) ))
<div class="checkbox @if($mode == 'edit') d-none @endif"> <div class="checkbox @if($mode == 'edit') d-none @endif">
<label for="create_inverse"> <label for="create_inverse">
<input type="checkbox" id="create_inverse" name="create_inverse:skip" checked> {{ $__t('Create inverse QU conversion') }} <input type="checkbox"
<span id="qu-conversion-inverse-info" class="form-text text-info d-none"></span> id="create_inverse"
name="create_inverse:skip"
checked> {{ $__t('Create inverse QU conversion') }}
<span id="qu-conversion-inverse-info"
class="form-text text-info d-none"></span>
</label> </label>
</div> </div>
@include('components.userfieldsform', array( @include('components.userfieldsform', array(
'userfields' => $userfields, 'userfields' => $userfields,
'entity' => 'quantity_unit_conversions' 'entity' => 'quantity_unit_conversions'
)) ))
<button id="save-quconversion-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-quconversion-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit quantity unit')) @section('title', $__t('Edit quantity unit'))
@else @else
@section('title', $__t('Create quantity unit')) @section('title', $__t('Create quantity unit'))
@endif @endif
@section('viewJsName', 'quantityunitform') @section('viewJsName', 'quantityunitform')
@@ -17,23 +17,37 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<script>Grocy.EditMode = '{{ $mode }}';</script> <script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $quantityUnit->id }};</script> <script>
Grocy.EditObjectId = {{ $quantityUnit->id }};
</script>
@endif @endif
<form id="quantityunit-form" novalidate> <form id="quantityunit-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Name') }} <span class="small text-muted">{{ $__t('in singular form') }}</span></label> <label for="name">{{ $__t('Name') }} <span class="small text-muted">{{ $__t('in singular form') }}</span></label>
<input type="text" class="form-control" required id="name" name="name" value="@if($mode == 'edit'){{ $quantityUnit->name }}@endif"> <input type="text"
class="form-control"
required
id="name"
name="name"
value="@if($mode == 'edit'){{ $quantityUnit->name }}@endif">
<div class="invalid-feedback">{{ $__t('A name is required') }}</div> <div class="invalid-feedback">{{ $__t('A name is required') }}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="name_plural">{{ $__t('Name') }} <span class="small text-muted">{{ $__t('in plural form') }}</span></label> <label for="name_plural">{{ $__t('Name') }} <span class="small text-muted">{{ $__t('in plural form') }}</span></label>
<input type="text" class="form-control" id="name_plural" name="name_plural" value="@if($mode == 'edit'){{ $quantityUnit->name_plural }}@endif"> <input type="text"
class="form-control"
id="name_plural"
name="name_plural"
value="@if($mode == 'edit'){{ $quantityUnit->name_plural }}@endif">
</div> </div>
@if($pluralCount > 2) @if($pluralCount > 2)
@@ -46,24 +60,32 @@
{{ $__t('Plural rule') }}: {{ $pluralRule }} {{ $__t('Plural rule') }}: {{ $pluralRule }}
</span> </span>
</label> </label>
<textarea class="form-control" rows="3" id="plural_forms" name="plural_forms">@if($mode == 'edit'){{ $quantityUnit->plural_forms }}@endif</textarea> <textarea class="form-control"
rows="3"
id="plural_forms"
name="plural_forms">@if($mode == 'edit'){{ $quantityUnit->plural_forms }}@endif</textarea>
</div> </div>
@endif @endif
<div class="form-group"> <div class="form-group">
<label for="description">{{ $__t('Description') }}</label> <label for="description">{{ $__t('Description') }}</label>
<textarea class="form-control" rows="2" id="description" name="description">@if($mode == 'edit'){{ $quantityUnit->description }}@endif</textarea> <textarea class="form-control"
rows="2"
id="description"
name="description">@if($mode == 'edit'){{ $quantityUnit->description }}@endif</textarea>
</div> </div>
@include('components.userfieldsform', array( @include('components.userfieldsform', array(
'userfields' => $userfields, 'userfields' => $userfields,
'entity' => 'quantity_units' 'entity' => 'quantity_units'
)) ))
<button id="save-quantityunit-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-quantityunit-button"
class="btn btn-success">{{ $__t('Save') }}</button>
@if(intval($pluralCount) > 2) @if(intval($pluralCount) > 2)
<button id="test-quantityunit-plural-forms-button" class="btn btn-secondary">{{ $__t('Test plural forms') }}</button> <button id="test-quantityunit-plural-forms-button"
class="btn btn-secondary">{{ $__t('Test plural forms') }}</button>
@endif @endif
</form> </form>
@@ -72,12 +94,16 @@
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<h2> <h2>
{{ $__t('Default conversions') }} {{ $__t('Default conversions') }}
<a id="qu-conversion-add-button" class="btn btn-outline-dark" href="#"> <a id="qu-conversion-add-button"
class="btn btn-outline-dark"
href="#">
<i class="fas fa-plus"></i> {{ $__t('Add') }} <i class="fas fa-plus"></i> {{ $__t('Add') }}
</a> </a>
</h2> </h2>
<h5 id="qu-conversion-headline-info" class="text-muted font-italic"></h5> <h5 id="qu-conversion-headline-info"
<table id="qu-conversions-table" class="table table-sm table-striped dt-responsive"> class="text-muted font-italic"></h5>
<table id="qu-conversions-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -90,10 +116,14 @@
@foreach($defaultQuConversions as $defaultQuConversion) @foreach($defaultQuConversions as $defaultQuConversion)
<tr> <tr>
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-sm btn-info qu-conversion-edit-button" href="#" data-qu-conversion-id="{{ $defaultQuConversion->id }}"> <a class="btn btn-sm btn-info qu-conversion-edit-button"
href="#"
data-qu-conversion-id="{{ $defaultQuConversion->id }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-sm btn-danger qu-conversion-delete-button" href="#" data-qu-conversion-id="{{ $defaultQuConversion->id }}"> <a class="btn btn-sm btn-danger qu-conversion-delete-button"
href="#"
data-qu-conversion-id="{{ $defaultQuConversion->id }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
</td> </td>

View File

@@ -5,7 +5,8 @@
@section('viewJsName', 'quantityunitpluraltesting') @section('viewJsName', 'quantityunitpluraltesting')
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
@endpush @endpush
@section('content') @section('content')
@@ -17,25 +18,30 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<form id="quantityunitpluraltesting-form" novalidate> <form id="quantityunitpluraltesting-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="qu_id">{{ $__t('Quantity unit') }}</label> <label for="qu_id">{{ $__t('Quantity unit') }}</label>
<select class="form-control" id="qu_id" name="qu_id"> <select class="form-control"
id="qu_id"
name="qu_id">
<option></option> <option></option>
@foreach($quantityUnits as $quantityUnit) @foreach($quantityUnits as $quantityUnit)
<option value="{{ $quantityUnit->id }}" data-singular-form="{{ $quantityUnit->name }}" data-plural-form="{{ $quantityUnit->name_plural }}">{{ $quantityUnit->name }}</option> <option value="{{ $quantityUnit->id }}"
data-singular-form="{{ $quantityUnit->name }}"
data-plural-form="{{ $quantityUnit->name_plural }}">{{ $quantityUnit->name }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'amount', 'id' => 'amount',
'label' => 'Amount', 'label' => 'Amount',
'min' => 0, 'min' => 0,
'step' => 1, 'step' => 1,
'isRequired' => false, 'isRequired' => false,
'value' => 1 'value' => 1
)) ))
</form> </form>

View File

@@ -10,7 +10,8 @@
<div class="title-related-links"> <div class="title-related-links">
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<div class="related-links"> <div class="related-links">
<a class="btn btn-outline-secondary" href="{{ $U('/userfields?entity=quantity_units') }}"> <a class="btn btn-outline-secondary"
href="{{ $U('/userfields?entity=quantity_units') }}">
{{ $__t('Configure userfields') }} {{ $__t('Configure userfields') }}
</a> </a>
</div> </div>
@@ -20,7 +21,8 @@
<hr> <hr>
<div class="row mt-3"> <div class="row mt-3">
<div class="col-xs-12 col-md-2 col-xl-1"> <div class="col-xs-12 col-md-2 col-xl-1">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3" href="{{ $U('/quantityunit/new') }}"> <a class="btn btn-primary btn-sm responsive-button w-100 mb-3"
href="{{ $U('/quantityunit/new') }}">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
@@ -29,16 +31,20 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="quantityunits-table" class="table table-sm table-striped dt-responsive"> <table id="quantityunits-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -46,7 +52,7 @@
<th>{{ $__t('Description') }}</th> <th>{{ $__t('Description') }}</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
</thead> </thead>
@@ -54,10 +60,14 @@
@foreach($quantityunits as $quantityunit) @foreach($quantityunits as $quantityunit)
<tr> <tr>
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-info btn-sm" href="{{ $U('/quantityunit/') }}{{ $quantityunit->id }}"> <a class="btn btn-info btn-sm"
href="{{ $U('/quantityunit/') }}{{ $quantityunit->id }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-danger btn-sm quantityunit-delete-button" href="#" data-quantityunit-id="{{ $quantityunit->id }}" data-quantityunit-name="{{ $quantityunit->name }}"> <a class="btn btn-danger btn-sm quantityunit-delete-button"
href="#"
data-quantityunit-id="{{ $quantityunit->id }}"
data-quantityunit-name="{{ $quantityunit->name }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
</td> </td>
@@ -69,8 +79,8 @@
</td> </td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $quantityunit->id) 'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $quantityunit->id)
)) ))
</tr> </tr>

View File

@@ -1,20 +1,21 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit recipe')) @section('title', $__t('Edit recipe'))
@else @else
@section('title', $__t('Create recipe')) @section('title', $__t('Create recipe'))
@endif @endif
@section('viewJsName', 'recipeform') @section('viewJsName', 'recipeform')
@push('pageScripts') @push('pageScripts')
<script src="{{ $U('/node_modules/datatables.net-rowgroup/js/dataTables.rowGroup.min.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/node_modules/datatables.net-rowgroup/js/dataTables.rowGroup.min.js?v=', true) }}{{ $version }}"></script>
<script src="{{ $U('/node_modules/datatables.net-rowgroup-bs4/js/rowGroup.bootstrap4.min.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/node_modules/datatables.net-rowgroup-bs4/js/rowGroup.bootstrap4.min.js?v=', true) }}{{ $version }}"></script>
@endpush @endpush
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/datatables.net-rowgroup-bs4/css/rowGroup.bootstrap4.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/datatables.net-rowgroup-bs4/css/rowGroup.bootstrap4.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
@endpush @endpush
@section('content') @section('content')
@@ -29,91 +30,117 @@
</script> </script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $recipe->id }};</script> <script>
Grocy.EditObjectId = {{ $recipe->id }};
</script>
@if(!empty($recipe->picture_file_name)) @if(!empty($recipe->picture_file_name))
<script>Grocy.RecipePictureFileName = '{{ $recipe->picture_file_name }}';</script> <script>
@endif Grocy.RecipePictureFileName = '{{ $recipe->picture_file_name }}';
</script>
@endif
@endif @endif
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-7 pb-3"> <div class="col-xs-12 col-md-7 pb-3">
<form id="recipe-form" novalidate> <form id="recipe-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Name') }}</label> <label for="name">{{ $__t('Name') }}</label>
<input type="text" class="form-control" required id="name" name="name" value="@if($mode == 'edit'){{ $recipe->name }}@endif"> <input type="text"
class="form-control"
required
id="name"
name="name"
value="@if($mode == 'edit'){{ $recipe->name }}@endif">
<div class="invalid-feedback">{{ $__t('A name is required') }}</div> <div class="invalid-feedback">{{ $__t('A name is required') }}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="recipe-picture"> <label for="recipe-picture">
{{ $__t('Picture') }} {{ $__t('Picture') }}
</label> </label>
<div class="input-group"> <div class="input-group">
<div class="custom-file"> <div class="custom-file">
<input type="file" class="custom-file-input" id="recipe-picture" accept="image/*"> <input type="file"
<label id="recipe-picture-label" class="custom-file-label @if(empty($recipe->picture_file_name)) d-none @endif" for="recipe-picture"> class="custom-file-input"
{{ $recipe->picture_file_name }} id="recipe-picture"
</label> accept="image/*">
<label id="recipe-picture-label-none" class="custom-file-label @if(!empty($recipe->picture_file_name)) d-none @endif" for="recipe-picture"> <label id="recipe-picture-label"
{{ $__t('No file selected') }} class="custom-file-label @if(empty($recipe->picture_file_name)) d-none @endif"
</label> for="recipe-picture">
</div> {{ $recipe->picture_file_name }}
<div class="input-group-append"> </label>
<span class="input-group-text"><i class="fas fa-trash" id="delete-current-recipe-picture-button"></i></span> <label id="recipe-picture-label-none"
</div> class="custom-file-label @if(!empty($recipe->picture_file_name)) d-none @endif"
for="recipe-picture">
{{ $__t('No file selected') }}
</label>
</div>
<div class="input-group-append">
<span class="input-group-text"><i class="fas fa-trash"
id="delete-current-recipe-picture-button"></i></span>
</div> </div>
</div> </div>
</div>
@php if($mode == 'edit') { $value = $recipe->base_servings; } else { $value = 1; } @endphp @php if($mode == 'edit') { $value = $recipe->base_servings; } else { $value = 1; } @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'base_servings', 'id' => 'base_servings',
'label' => 'Servings', 'label' => 'Servings',
'min' => 1, 'min' => 1,
'value' => $value, 'value' => $value,
'invalidFeedback' => $__t('This cannot be lower than %s', '1'), 'invalidFeedback' => $__t('This cannot be lower than %s', '1'),
'hint' => $__t('The ingredients listed here result in this amount of servings') 'hint' => $__t('The ingredients listed here result in this amount of servings')
)) ))
<div class="form-group"> <div class="form-group">
<div class="custom-control custom-checkbox"> <div class="custom-control custom-checkbox">
<input type="hidden" name="not_check_shoppinglist" value="0"> <input type="hidden"
<input @if($mode == 'edit' && $recipe->not_check_shoppinglist == 1) checked @endif class="form-check-input custom-control-input" type="checkbox" id="not_check_shoppinglist" name="not_check_shoppinglist" value="1"> name="not_check_shoppinglist"
<label class="form-check-label custom-control-label" for="not_check_shoppinglist"> value="0">
<input @if($mode=='edit'
&&
$recipe->not_check_shoppinglist == 1) checked @endif class="form-check-input custom-control-input" type="checkbox" id="not_check_shoppinglist" name="not_check_shoppinglist" value="1">
<label class="form-check-label custom-control-label"
for="not_check_shoppinglist">
{{ $__t('Do not check against the shopping list when adding missing items to it') }}&nbsp; {{ $__t('Do not check against the shopping list when adding missing items to it') }}&nbsp;
<i class="fas fa-question-circle" <i class="fas fa-question-circle"
data-toggle="tooltip" data-toggle="tooltip"
title="{{ $__t('By default the amount to be added to the shopping list is `needed amount - stock amount - shopping list amount` - when this is enabled, it is only checked against the stock amount, not against what is already on the shopping list') }}" title="{{ $__t('By default the amount to be added to the shopping list is `needed amount - stock amount - shopping list amount` - when this is enabled, it is only checked against the stock amount, not against what is already on the shopping list') }}"></i>
></i>
</label> </label>
</div> </div>
</div> </div>
@include('components.productpicker', array( @include('components.productpicker', array(
'products' => $products, 'products' => $products,
'isRequired' => false, 'isRequired' => false,
'label' => 'Produces product', 'label' => 'Produces product',
'prefillById' => $mode == 'edit' ? $recipe->product_id : '', 'prefillById' => $mode == 'edit' ? $recipe->product_id : '',
'hint' => $__t('When a product is selected, one unit (per serving in purchase quantity unit) will be added to stock on consuming this recipe') 'hint' => $__t('When a product is selected, one unit (per serving in purchase quantity unit) will be added to stock on consuming this recipe')
)) ))
@include('components.userfieldsform', array( @include('components.userfieldsform', array(
'userfields' => $userfields, 'userfields' => $userfields,
'entity' => 'recipes' 'entity' => 'recipes'
)) ))
<div class="form-group"> <div class="form-group">
<label for="description">{{ $__t('Preparation') }}</label> <label for="description">{{ $__t('Preparation') }}</label>
<textarea id="description" class="form-control wysiwyg-editor" name="description">@if($mode == 'edit'){{ $recipe->description }}@endif</textarea> <textarea id="description"
class="form-control wysiwyg-editor"
name="description">@if($mode == 'edit'){{ $recipe->description }}@endif</textarea>
</div> </div>
<small class="my-2 form-text text-muted @if($mode == 'edit') d-none @endif">{{ $__t('Save & continue to add ingredients and included recipes') }}</small> <small class="my-2 form-text text-muted @if($mode == 'edit') d-none @endif">{{ $__t('Save & continue to add ingredients and included recipes') }}</small>
<button class="save-recipe btn btn-success mb-2" data-location="continue">{{ $__t('Save & continue') }}</button> <button class="save-recipe btn btn-success mb-2"
<button class="save-recipe btn btn-info mb-2" data-location="return">{{ $__t('Save & return to recipes') }}</button> data-location="continue">{{ $__t('Save & continue') }}</button>
<button class="save-recipe btn btn-info mb-2"
data-location="return">{{ $__t('Save & return to recipes') }}</button>
</form> </form>
</div> </div>
@@ -122,10 +149,14 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
@if(!empty($recipe->picture_file_name)) @if(!empty($recipe->picture_file_name))
<img id="current-recipe-picture" data-src="{{ $U('/api/files/recipepictures/' . base64_encode($recipe->picture_file_name) . '?force_serve_as=picture&best_fit_width=400') }}" class="img-fluid img-thumbnail mt-2 lazy mb-5"> <img id="current-recipe-picture"
<p id="delete-current-recipe-picture-on-save-hint" class="form-text text-muted font-italic d-none mb-5">{{ $__t('The current picture will be deleted when you save the recipe') }}</p> data-src="{{ $U('/api/files/recipepictures/' . base64_encode($recipe->picture_file_name) . '?force_serve_as=picture&best_fit_width=400') }}"
class="img-fluid img-thumbnail mt-2 lazy mb-5">
<p id="delete-current-recipe-picture-on-save-hint"
class="form-text text-muted font-italic d-none mb-5">{{ $__t('The current picture will be deleted when you save the recipe') }}</p>
@else @else
<p id="no-current-recipe-picture-hint" class="form-text text-muted font-italic mb-5">{{ $__t('No picture available') }}</p> <p id="no-current-recipe-picture-hint"
class="form-text text-muted font-italic mb-5">{{ $__t('No picture available') }}</p>
@endif @endif
</div> </div>
</div> </div>
@@ -137,13 +168,17 @@
{{ $__t('Ingredients list') }} {{ $__t('Ingredients list') }}
</h4> </h4>
<div class="related-links"> <div class="related-links">
<a id="recipe-pos-add-button" class="btn btn-outline-primary btn-sm recipe-pos-add-button" type="button" href="#"> <a id="recipe-pos-add-button"
class="btn btn-outline-primary btn-sm recipe-pos-add-button"
type="button"
href="#">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
</div> </div>
<table id="recipes-pos-table" class="table table-sm table-striped dt-responsive"> <table id="recipes-pos-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -158,10 +193,17 @@
@foreach($recipePositions as $recipePosition) @foreach($recipePositions as $recipePosition)
<tr> <tr>
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-sm btn-info recipe-pos-edit-button" type="button" href="#" data-recipe-pos-id="{{ $recipePosition->id }}" data-product-id="{{ $recipePosition->product_id }}"> <a class="btn btn-sm btn-info recipe-pos-edit-button"
type="button"
href="#"
data-recipe-pos-id="{{ $recipePosition->id }}"
data-product-id="{{ $recipePosition->product_id }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-sm btn-danger recipe-pos-delete-button" href="#" data-recipe-pos-id="{{ $recipePosition->id }}" data-recipe-pos-name="{{ FindObjectInArrayByPropertyValue($products, 'id', $recipePosition->product_id)->name }}"> <a class="btn btn-sm btn-danger recipe-pos-delete-button"
href="#"
data-recipe-pos-id="{{ $recipePosition->id }}"
data-recipe-pos-name="{{ FindObjectInArrayByPropertyValue($products, 'id', $recipePosition->product_id)->name }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
</td> </td>
@@ -170,28 +212,33 @@
</td> </td>
<td> <td>
@php @php
$product = FindObjectInArrayByPropertyValue($products, 'id', $recipePosition->product_id); $product = FindObjectInArrayByPropertyValue($products, 'id', $recipePosition->product_id);
$productQuConversions = FindAllObjectsInArrayByPropertyValue($quantityUnitConversionsResolved, 'product_id', $product->id); $productQuConversions = FindAllObjectsInArrayByPropertyValue($quantityUnitConversionsResolved, 'product_id', $product->id);
$productQuConversions = FindAllObjectsInArrayByPropertyValue($productQuConversions, 'from_qu_id', $product->qu_id_stock); $productQuConversions = FindAllObjectsInArrayByPropertyValue($productQuConversions, 'from_qu_id', $product->qu_id_stock);
$productQuConversion = FindObjectInArrayByPropertyValue($productQuConversions, 'to_qu_id', $recipePosition->qu_id); $productQuConversion = FindObjectInArrayByPropertyValue($productQuConversions, 'to_qu_id', $recipePosition->qu_id);
if ($productQuConversion) if ($productQuConversion)
{ {
$recipePosition->amount = $recipePosition->amount * $productQuConversion->factor; $recipePosition->amount = $recipePosition->amount * $productQuConversion->factor;
} }
@endphp @endphp
@if(!empty($recipePosition->variable_amount)) @if(!empty($recipePosition->variable_amount))
{{ $recipePosition->variable_amount }} {{ $recipePosition->variable_amount }}
@else @else
<span class="locale-number locale-number-quantity-amount">@if($recipePosition->amount == round($recipePosition->amount)){{ round($recipePosition->amount) }}@else{{ $recipePosition->amount }}@endif</span> <span class="locale-number locale-number-quantity-amount">@if($recipePosition->amount == round($recipePosition->amount)){{ round($recipePosition->amount) }}@else{{ $recipePosition->amount }}@endif</span>
@endif @endif
{{ $__n($recipePosition->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', $recipePosition->qu_id)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', $recipePosition->qu_id)->name_plural) }} {{ $__n($recipePosition->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', $recipePosition->qu_id)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', $recipePosition->qu_id)->name_plural) }}
@if(!empty($recipePosition->variable_amount)) @if(!empty($recipePosition->variable_amount))
<div class="small text-muted font-italic">{{ $__t('Variable amount') }}</div> <div class="small text-muted font-italic">{{ $__t('Variable amount') }}</div>
@endif @endif
</td> </td>
<td class="fit-content"> <td class="fit-content">
<a class="btn btn-sm btn-info recipe-pos-show-note-button @if(empty($recipePosition->note)) disabled @endif" href="#" data-toggle="tooltip" data-placement="top" title="{{ $__t('Show notes') }}" data-recipe-pos-note="{{ $recipePosition->note }}"> <a class="btn btn-sm btn-info recipe-pos-show-note-button @if(empty($recipePosition->note)) disabled @endif"
href="#"
data-toggle="tooltip"
data-placement="top"
title="{{ $__t('Show notes') }}"
data-recipe-pos-note="{{ $recipePosition->note }}">
<i class="fas fa-eye"></i> <i class="fas fa-eye"></i>
</a> </a>
</td> </td>
@@ -213,12 +260,15 @@
{{ $__t('Included recipes') }} {{ $__t('Included recipes') }}
</h4> </h4>
<div class="related-links"> <div class="related-links">
<a id="recipe-include-add-button" class="btn btn-outline-primary btn-sm" href="#"> <a id="recipe-include-add-button"
class="btn btn-outline-primary btn-sm"
href="#">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
</div> </div>
<table id="recipes-includes-table" class="table table-sm table-striped dt-responsive"> <table id="recipes-includes-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -231,10 +281,17 @@
@foreach($recipeNestings as $recipeNesting) @foreach($recipeNestings as $recipeNesting)
<tr> <tr>
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-sm btn-info recipe-include-edit-button" href="#" data-recipe-include-id="{{ $recipeNesting->id }}" data-recipe-included-recipe-id="{{ $recipeNesting->includes_recipe_id }}" data-recipe-included-recipe-servings="{{ $recipeNesting->servings }}"> <a class="btn btn-sm btn-info recipe-include-edit-button"
href="#"
data-recipe-include-id="{{ $recipeNesting->id }}"
data-recipe-included-recipe-id="{{ $recipeNesting->includes_recipe_id }}"
data-recipe-included-recipe-servings="{{ $recipeNesting->servings }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-sm btn-danger recipe-include-delete-button" href="#" data-recipe-include-id="{{ $recipeNesting->id }}" data-recipe-include-name="{{ FindObjectInArrayByPropertyValue($recipes, 'id', $recipeNesting->includes_recipe_id)->name }}"> <a class="btn btn-sm btn-danger recipe-include-delete-button"
href="#"
data-recipe-include-id="{{ $recipeNesting->id }}"
data-recipe-include-name="{{ FindObjectInArrayByPropertyValue($recipes, 'id', $recipeNesting->includes_recipe_id)->name }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
</td> </td>
@@ -255,33 +312,41 @@
</div> </div>
<div class="modal fade" id="recipe-include-editform-modal" tabindex="-1"> <div class="modal fade"
id="recipe-include-editform-modal"
tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content text-center"> <div class="modal-content text-center">
<div class="modal-header"> <div class="modal-header">
<h4 id="recipe-include-editform-title" class="modal-title w-100"></h4> <h4 id="recipe-include-editform-title"
class="modal-title w-100"></h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form id="recipe-include-form" novalidate> <form id="recipe-include-form"
novalidate>
@include('components.recipepicker', array( @include('components.recipepicker', array(
'recipes' => $recipes, 'recipes' => $recipes,
'isRequired' => true 'isRequired' => true
)) ))
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'includes_servings', 'id' => 'includes_servings',
'label' => 'Servings', 'label' => 'Servings',
'min' => 1, 'min' => 1,
'value' => '1', 'value' => '1',
'invalidFeedback' => $__t('This cannot be lower than %s', '1') 'invalidFeedback' => $__t('This cannot be lower than %s', '1')
)) ))
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ $__t('Cancel') }}</button> <button type="button"
<button id="save-recipe-include-button" data-dismiss="modal" class="btn btn-success">{{ $__t('Save') }}</button> class="btn btn-secondary"
data-dismiss="modal">{{ $__t('Cancel') }}</button>
<button id="save-recipe-include-button"
data-dismiss="modal"
class="btn btn-success">{{ $__t('Save') }}</button>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit recipe ingredient')) @section('title', $__t('Edit recipe ingredient'))
@else @else
@section('title', $__t('Add recipe ingredient')) @section('title', $__t('Add recipe ingredient'))
@endif @endif
@section('viewJsName', 'recipeposform') @section('viewJsName', 'recipeposform')
@@ -28,22 +28,30 @@
</script> </script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $recipePos->id }};</script> <script>
Grocy.EditObjectId = {{ $recipePos->id }};
</script>
@endif @endif
<form id="recipe-pos-form" novalidate> <form id="recipe-pos-form"
novalidate>
@include('components.productpicker', array( @include('components.productpicker', array(
'products' => $products, 'products' => $products,
'nextInputSelector' => '#amount' 'nextInputSelector' => '#amount'
)) ))
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="form-check form-group mb-1"> <div class="form-check form-group mb-1">
<input type="hidden" name="only_check_single_unit_in_stock" value="0"> <input type="hidden"
<input @if($mode == 'edit' && $recipePos->only_check_single_unit_in_stock == 1) checked @endif class="form-check-input" type="checkbox" id="only_check_single_unit_in_stock" name="only_check_single_unit_in_stock" value="1"> name="only_check_single_unit_in_stock"
<label class="form-check-label" for="only_check_single_unit_in_stock">{{ $__t('Only check if a single unit is in stock (a different quantity can then be used above)') }}</label> value="0">
<input @if($mode=='edit'
&&
$recipePos->only_check_single_unit_in_stock == 1) checked @endif class="form-check-input" type="checkbox" id="only_check_single_unit_in_stock" name="only_check_single_unit_in_stock" value="1">
<label class="form-check-label"
for="only_check_single_unit_in_stock">{{ $__t('Only check if a single unit is in stock (a different quantity can then be used above)') }}</label>
</div> </div>
</div> </div>
</div> </div>
@@ -51,50 +59,70 @@
@php if($mode == 'edit') { $value = $recipePos->amount; } else { $value = 1; } @endphp @php if($mode == 'edit') { $value = $recipePos->amount; } else { $value = 1; } @endphp
@php if($mode == 'edit') { $initialQuId = $recipePos->qu_id; } else { $initialQuId = ''; } @endphp @php if($mode == 'edit') { $initialQuId = $recipePos->qu_id; } else { $initialQuId = ''; } @endphp
@include('components.productamountpicker', array( @include('components.productamountpicker', array(
'value' => $value, 'value' => $value,
'initialQuId' => $initialQuId, 'initialQuId' => $initialQuId,
'additionalGroupCssClasses' => 'mb-0' 'additionalGroupCssClasses' => 'mb-0'
)) ))
<div class="form-group"> <div class="form-group">
<label for="variable_amount">{{ $__t('Variable amount') }}&nbsp;&nbsp;<span class="small text-muted">{{ $__t('When this is not empty, it will be shown instead of the amount entered above while the amount there will still be used for stock fulfillment checking') }}</span></label> <label for="variable_amount">{{ $__t('Variable amount') }}&nbsp;&nbsp;<span class="small text-muted">{{ $__t('When this is not empty, it will be shown instead of the amount entered above while the amount there will still be used for stock fulfillment checking') }}</span></label>
<input type="text" class="form-control" id="variable_amount" name="variable_amount" value="@if($mode == 'edit'){{ $recipePos->variable_amount }}@endif"> <input type="text"
class="form-control"
id="variable_amount"
name="variable_amount"
value="@if($mode == 'edit'){{ $recipePos->variable_amount }}@endif">
</div> </div>
<div class="form-check mb-3"> <div class="form-check mb-3">
<input type="hidden" name="not_check_stock_fulfillment" value="0"> <input type="hidden"
<input @if($mode == 'edit' && ($recipePos->not_check_stock_fulfillment == 1 || FindObjectInArrayByPropertyValue($products, 'id', $recipePos->product_id)->not_check_stock_fulfillment_for_recipes == 1)) checked @endif class="form-check-input" type="checkbox" id="not_check_stock_fulfillment" name="not_check_stock_fulfillment" value="1"> name="not_check_stock_fulfillment"
<label class="form-check-label" for="not_check_stock_fulfillment">{{ $__t('Disable stock fulfillment checking for this ingredient') }}</label> value="0">
<input @if($mode=='edit'
&&
($recipePos->not_check_stock_fulfillment == 1 || FindObjectInArrayByPropertyValue($products, 'id', $recipePos->product_id)->not_check_stock_fulfillment_for_recipes == 1)) checked @endif class="form-check-input" type="checkbox" id="not_check_stock_fulfillment" name="not_check_stock_fulfillment" value="1">
<label class="form-check-label"
for="not_check_stock_fulfillment">{{ $__t('Disable stock fulfillment checking for this ingredient') }}</label>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="ingredient_group">{{ $__t('Group') }}&nbsp;&nbsp;<span class="small text-muted">{{ $__t('This will be used as a headline to group ingredients together') }}</span></label> <label for="ingredient_group">{{ $__t('Group') }}&nbsp;&nbsp;<span class="small text-muted">{{ $__t('This will be used as a headline to group ingredients together') }}</span></label>
<input type="text" class="form-control" id="ingredient_group" name="ingredient_group" value="@if($mode == 'edit'){{ $recipePos->ingredient_group }}@endif"> <input type="text"
class="form-control"
id="ingredient_group"
name="ingredient_group"
value="@if($mode == 'edit'){{ $recipePos->ingredient_group }}@endif">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="note">{{ $__t('Note') }}</label> <label for="note">{{ $__t('Note') }}</label>
<textarea class="form-control" rows="2" id="note" name="note">@if($mode == 'edit'){{ $recipePos->note }}@endif</textarea> <textarea class="form-control"
rows="2"
id="note"
name="note">@if($mode == 'edit'){{ $recipePos->note }}@endif</textarea>
</div> </div>
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
@php if($mode == 'edit') { $value = $recipePos->price_factor; } else { $value = 1; } @endphp @php if($mode == 'edit') { $value = $recipePos->price_factor; } else { $value = 1; } @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'price_factor', 'id' => 'price_factor',
'label' => 'Price factor', 'label' => 'Price factor',
'min' => 0, 'min' => 0,
'step' => 0.01, 'step' => 0.01,
'value' => '', 'value' => '',
'hint' => $__t('The resulting price of this ingredient will be multiplied by this factor'), 'hint' => $__t('The resulting price of this ingredient will be multiplied by this factor'),
'invalidFeedback' => $__t('This cannot be lower than %s', '0'), 'invalidFeedback' => $__t('This cannot be lower than %s', '0'),
'isRequired' => true, 'isRequired' => true,
'value' => $value 'value' => $value
)) ))
@else @else
<input type="hidden" name="price_factor" id="price" value="1"> <input type="hidden"
name="price_factor"
id="price"
value="1">
@endif @endif
<button id="save-recipe-pos-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-recipe-pos-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>

View File

@@ -20,7 +20,8 @@
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-4 col-xl-2"> <div class="col-xs-12 col-md-4 col-xl-2">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3" href="{{ $U('/recipe/new') }}"> <a class="btn btn-primary btn-sm responsive-button w-100 mb-3"
href="{{ $U('/recipe/new') }}">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
@@ -29,18 +30,22 @@
<div class="col-xs-12 col-md-6 col-xl-6"> <div class="col-xs-12 col-md-6 col-xl-6">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
<div class="col-xs-12 col-md-6 col-xl-6"> <div class="col-xs-12 col-md-6 col-xl-6">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-filter"></i></span> <span class="input-group-text"><i class="fas fa-filter"></i></span>
</div> </div>
<select class="form-control" id="status-filter"> <select class="form-control"
id="status-filter">
<option value="all">{{ $__t('All') }}</option> <option value="all">{{ $__t('All') }}</option>
<option value="enoughtinstock">{{ $__t('Enough in stock') }}</option> <option value="enoughtinstock">{{ $__t('Enough in stock') }}</option>
<option value="enoughinstockwithshoppinglist">{{ $__t('Not enough in stock, but already on the shopping list') }}</option> <option value="enoughinstockwithshoppinglist">{{ $__t('Not enough in stock, but already on the shopping list') }}</option>
@@ -52,16 +57,24 @@
<ul class="nav nav-tabs mt-3 mb-1 grocy-tabs"> <ul class="nav nav-tabs mt-3 mb-1 grocy-tabs">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active" id="list-tab" data-toggle="tab" href="#list">{{ $__t('List') }}</a> <a class="nav-link active"
id="list-tab"
data-toggle="tab"
href="#list">{{ $__t('List') }}</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="gallery-tab" data-toggle="tab" href="#gallery">{{ $__t('Gallery') }}</a> <a class="nav-link"
id="gallery-tab"
data-toggle="tab"
href="#gallery">{{ $__t('Gallery') }}</a>
</li> </li>
</ul> </ul>
<div class="tab-content grocy-tabs"> <div class="tab-content grocy-tabs">
<div class="tab-pane show active" id="list"> <div class="tab-pane show active"
<table id="recipes-table" class="table table-sm table-striped dt-responsive"> id="list">
<table id="recipes-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -73,19 +86,24 @@
<th class="d-none">Hidden recipe ingredient product names</th> <th class="d-none">Hidden recipe ingredient product names</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
</thead> </thead>
<tbody class="d-none"> <tbody class="d-none">
@foreach($recipes as $recipe) @foreach($recipes as $recipe)
<tr id="recipe-row-{{ $recipe->id }}" data-recipe-id="{{ $recipe->id }}"> <tr id="recipe-row-{{ $recipe->id }}"
data-recipe-id="{{ $recipe->id }}">
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-info btn-sm hide-when-embedded hide-on-fullscreen-card" href="{{ $U('/recipe/') }}{{ $recipe->id }}"> <a class="btn btn-info btn-sm hide-when-embedded hide-on-fullscreen-card"
href="{{ $U('/recipe/') }}{{ $recipe->id }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-sm btn-danger hide-when-embedded hide-on-fullscreen-card recipe-delete" href="#" data-recipe-id="{{ $recipe->id }}" data-recipe-name="{{ $recipe->name }}"> <a class="btn btn-sm btn-danger hide-when-embedded hide-on-fullscreen-card recipe-delete"
href="#"
data-recipe-id="{{ $recipe->id }}"
data-recipe-name="{{ $recipe->name }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
</td> </td>
@@ -107,13 +125,13 @@
</td> </td>
<td class="d-none"> <td class="d-none">
@foreach(FindAllObjectsInArrayByPropertyValue($recipePositionsResolved, 'recipe_id', $recipe->id) as $recipePos) @foreach(FindAllObjectsInArrayByPropertyValue($recipePositionsResolved, 'recipe_id', $recipe->id) as $recipePos)
{{ FindObjectInArrayByPropertyValue($products, 'id', $recipePos->product_id)->name . ' ' }} {{ FindObjectInArrayByPropertyValue($products, 'id', $recipePos->product_id)->name . ' ' }}
@endforeach @endforeach
</td> </td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $recipe->id) 'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $recipe->id)
)) ))
</tr> </tr>
@@ -122,23 +140,28 @@
</table> </table>
</div> </div>
<div class="tab-pane show" id="gallery"> <div class="tab-pane show"
id="gallery">
<div class="card-columns no-gutters"> <div class="card-columns no-gutters">
@foreach($recipes as $recipe) @foreach($recipes as $recipe)
<a class="discrete-link recipe-gallery-item" data-recipe-id="{{ $recipe->id }}" href="#"> <a class="discrete-link recipe-gallery-item"
<div id="RecipeGalleryCard-{{ $recipe->id }}" class="card recipe-card"> data-recipe-id="{{ $recipe->id }}"
@if(!empty($recipe->picture_file_name)) href="#">
<img data-src="{{ $U('/api/files/recipepictures/' . base64_encode($recipe->picture_file_name) . '?force_serve_as=picture&best_fit_width=400') }}" class="card-img-top lazy"> <div id="RecipeGalleryCard-{{ $recipe->id }}"
@endif class="card recipe-card">
<div class="card-body text-center"> @if(!empty($recipe->picture_file_name))
<h5 class="card-title mb-1">{{ $recipe->name }}</h5> <img data-src="{{ $U('/api/files/recipepictures/' . base64_encode($recipe->picture_file_name) . '?force_serve_as=picture&best_fit_width=400') }}"
<p class="card-text"> class="card-img-top lazy">
@if(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled == 1)<i class="fas fa-check text-success"></i>@elseif(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled_with_shopping_list == 1)<i class="fas fa-exclamation text-warning"></i>@else<i class="fas fa-times text-danger"></i>@endif @endif
<span class="timeago-contextual">@if(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled == 1){{ $__t('Enough in stock') }}@elseif(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled_with_shopping_list == 1){{ $__n(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->missing_products_count, 'Not enough in stock, %s ingredient missing but already on the shopping list', 'Not enough in stock, %s ingredients missing but already on the shopping list') }}@else{{ $__n(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->missing_products_count, 'Not enough in stock (not included in costs), %s ingredient missing', 'Not enough in stock (not included in costs), %s ingredients missing') }}@endif</span> <div class="card-body text-center">
</p> <h5 class="card-title mb-1">{{ $recipe->name }}</h5>
</div> <p class="card-text">
@if(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled == 1)<i class="fas fa-check text-success"></i>@elseif(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled_with_shopping_list == 1)<i class="fas fa-exclamation text-warning"></i>@else<i class="fas fa-times text-danger"></i>@endif
<span class="timeago-contextual">@if(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled == 1){{ $__t('Enough in stock') }}@elseif(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled_with_shopping_list == 1){{ $__n(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->missing_products_count, 'Not enough in stock, %s ingredient missing but already on the shopping list', 'Not enough in stock, %s ingredients missing but already on the shopping list') }}@else{{ $__n(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->missing_products_count, 'Not enough in stock (not included in costs), %s ingredient missing', 'Not enough in stock (not included in costs), %s ingredients missing') }}@endif</span>
</p>
</div> </div>
</a> </div>
</a>
@endforeach @endforeach
</div> </div>
</div> </div>
@@ -147,229 +170,259 @@
@if($selectedRecipe !== null) @if($selectedRecipe !== null)
@php @php
$allRecipes = $selectedRecipeSubRecipes; $allRecipes = $selectedRecipeSubRecipes;
array_unshift($allRecipes, $selectedRecipe); array_unshift($allRecipes, $selectedRecipe);
@endphp @endphp
<div class="col-xs-12 col-md-6 print-view"> <div class="col-xs-12 col-md-6 print-view">
<div id="selectedRecipeCard" class="card grocy-card"> <div id="selectedRecipeCard"
class="card grocy-card">
@if(count($allRecipes) > 1) @if(count($allRecipes) > 1)
<div class="card-header card-header-fullscreen d-print-none"> <div class="card-header card-header-fullscreen d-print-none">
<ul class="nav nav-tabs grocy-tabs card-header-tabs"> <ul class="nav nav-tabs grocy-tabs card-header-tabs">
@foreach($allRecipes as $index=>$recipe) @foreach($allRecipes as $index=>$recipe)
<li class="nav-item"> <li class="nav-item">
<a class="nav-link @if($index == 0) active @endif" data-toggle="tab" href="#recipe-{{ $index + 1 }}">{{ $recipe->name }}</a> <a class="nav-link @if($index == 0) active @endif"
</li> data-toggle="tab"
@endforeach href="#recipe-{{ $index + 1 }}">{{ $recipe->name }}</a>
</ul> </li>
</div> @endforeach
</ul>
</div>
@endif @endif
<div class="tab-content grocy-tabs print break"> <div class="tab-content grocy-tabs print break">
@foreach($allRecipes as $index=>$recipe) @foreach($allRecipes as $index=>$recipe)
<div class="tab-pane @if($index == 0) active @endif" id="recipe-{{ $index + 1 }}" role="tabpanel"> <div class="tab-pane @if($index == 0) active @endif"
@if(!empty($recipe->picture_file_name)) id="recipe-{{ $index + 1 }}"
<img class="card-img-top lazy" src="{{ $U('/api/files/recipepictures/' . base64_encode($recipe->picture_file_name) . '?force_serve_as=picture') }}"> role="tabpanel">
@endif @if(!empty($recipe->picture_file_name))
<div class="card-body"> <img class="card-img-top lazy"
<div class="shadow p-4 mb-5 bg-white rounded mt-n5 d-print-none @if(empty($recipe->picture_file_name)) d-none @endif"> src="{{ $U('/api/files/recipepictures/' . base64_encode($recipe->picture_file_name) . '?force_serve_as=picture') }}">
<div class="d-flex justify-content-between align-items-center"> @endif
<h3 class="card-title mb-0">{{ $recipe->name }}</h3> <div class="card-body">
<div class="card-icons d-flex flex-wrap justify-content-end flex-shrink-1"> <div class="shadow p-4 mb-5 bg-white rounded mt-n5 d-print-none @if(empty($recipe->picture_file_name)) d-none @endif">
<a class="recipe-consume hide-when-embedded @if(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled == 0) disabled @endif" <div class="d-flex justify-content-between align-items-center">
href="#" <h3 class="card-title mb-0">{{ $recipe->name }}</h3>
data-toggle="tooltip" <div class="card-icons d-flex flex-wrap justify-content-end flex-shrink-1">
title="{{ $__t('Consume all ingredients needed by this recipe') }}" <a class="recipe-consume hide-when-embedded @if(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled == 0) disabled @endif"
data-recipe-id="{{ $recipe->id }}" href="#"
data-recipe-name="{{ $recipe->name }}"> data-toggle="tooltip"
<i class="fas fa-utensils"></i> title="{{ $__t('Consume all ingredients needed by this recipe') }}"
</a> data-recipe-id="{{ $recipe->id }}"
<a class="recipe-shopping-list hide-when-embedded @if(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled_with_shopping_list == 1) disabled @endif" data-recipe-name="{{ $recipe->name }}">
href="#" <i class="fas fa-utensils"></i>
data-toggle="tooltip" </a>
title="{{ $__t('Put missing products on shopping list') }}" <a class="recipe-shopping-list hide-when-embedded @if(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled_with_shopping_list == 1) disabled @endif"
data-recipe-id="{{ $recipe->id }}" href="#"
data-recipe-name="{{ $recipe->name }}"> data-toggle="tooltip"
<i class="fas fa-cart-plus"></i> title="{{ $__t('Put missing products on shopping list') }}"
</a> data-recipe-id="{{ $recipe->id }}"
<a class="recipe-fullscreen hide-when-embedded" data-recipe-name="{{ $recipe->name }}">
href="#" <i class="fas fa-cart-plus"></i>
data-toggle="tooltip" </a>
title="{{ $__t('Expand to fullscreen') }}"> <a class="recipe-fullscreen hide-when-embedded"
<i class="fas fa-expand-arrows-alt"></i> href="#"
</a> data-toggle="tooltip"
<a class="recipe-print hide-when-embedded" href="#" data-toggle="tooltip" title="{{ $__t('Print') }}"> title="{{ $__t('Expand to fullscreen') }}">
<i class="fas fa-print"></i> <i class="fas fa-expand-arrows-alt"></i>
</a> </a>
</div> <a class="recipe-print hide-when-embedded"
</div> href="#"
</div> data-toggle="tooltip"
title="{{ $__t('Print') }}">
<div class="mb-4 @if(!empty($recipe->picture_file_name)) d-none @else d-flex @endif d-print-block justify-content-between align-items-center"> <i class="fas fa-print"></i>
<h1 class="card-title mb-0">{{ $recipe->name }}</h1> </a>
<div class="card-icons d-flex flex-wrap justify-content-end flex-shrink-1 d-print-none">
<a class="recipe-consume hide-when-embedded @if(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled == 0) disabled @endif"
href="#"
data-toggle="tooltip"
title="{{ $__t('Consume all ingredients needed by this recipe') }}"
data-recipe-id="{{ $recipe->id }}"
data-recipe-name="{{ $recipe->name }}">
<i class="fas fa-utensils"></i>
</a>
<a class="recipe-shopping-list hide-when-embedded @if(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled_with_shopping_list == 1) disabled @endif"
href="#"
data-toggle="tooltip"
title="{{ $__t('Put missing products on shopping list') }}"
data-recipe-id="{{ $recipe->id }}"
data-recipe-name="{{ $recipe->name }}">
<i class="fas fa-cart-plus"></i>
</a>
<a class="recipe-fullscreen hide-when-embedded"
href="#"
data-toggle="tooltip"
title="{{ $__t('Expand to fullscreen') }}">
<i class="fas fa-expand-arrows-alt"></i>
</a>
<a class="recipe-print hide-when-embedded PrintRecipe" href="#" data-toggle="tooltip" title="{{ $__t('Print') }}">
<i class="fas fa-print"></i>
</a>
</div>
</div>
@php
$calories = FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->calories;
$costs = FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->costs;
@endphp
<div class="row ml-1">
@if(!empty($calories) && intval($calories) > 0)
<div class="col-6 col-xl-3">
<label>{{ $__t('Calories') }}</label>
<h3 class="locale-number locale-number-generic pt-0">{{ $calories }}</h3>
</div>
@endif
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
<div class="col-5">
<label>{{ $__t('Costs') }}&nbsp;</label>
<i class="fas fa-question-circle" data-toggle="tooltip" title="{{ $__t('Based on the prices of the default consume rule which is "First expiring first, then first in first out"') }}"></i>
<h3 class="locale-number locale-number-currency pt-0">{{ $costs }}</h3>
</div>
@endif
@if($index == 0)
<div class="col-12 col-xl-4 d-print-none">
@include('components.numberpicker', array(
'id' => 'servings-scale',
'label' => 'Desired servings',
'min' => 1,
'value' => $recipe->desired_servings,
'invalidFeedback' => $__t('This cannot be lower than %s', '1'),
'additionalAttributes' => 'data-recipe-id="' . $recipe->id . '"',
'hint' => $__t('Base: %s', $recipe->base_servings)
))
</div>
@endif
</div>
@php
$recipePositionsFiltered = FindAllObjectsInArrayByPropertyValue($allRecipePositions[$recipe->id], 'recipe_id', $recipe->id);
@endphp
<ul class="nav nav-tabs grocy-tabs mb-3 d-print-none" role="tablist">
@if(count($recipePositionsFiltered) > 0)
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#ingredients-{{ $index }}" role="tab">{{ $__t('Ingredients') }}</a>
</li>
@endif
@if(!empty($recipe->description))
<li class="nav-item">
<a class="nav-link @if(count($recipePositionsFiltered) == 0) active @endif" data-toggle="tab" href="#prep-{{ $index }}" role="tab">{{ $__t('Preparation') }}</a>
</li>
@endif
</ul>
<div class="tab-content grocy-tabs p-2 print">
@if(count($recipePositionsFiltered) > 0)
<div class="tab-pane active" id="ingredients-{{ $index }}" role="tabpanel">
<div class="mb-2 mt-3 d-none d-print-block">
<h3 class="mb-0">{{ $__t('Ingredients') }}</h3>
</div>
<ul class="list-group list-group-flush mb-5">
@php
$lastIngredientGroup = 'undefined';
$lastProductGroup = 'undefined';
$hasIngredientGroups = false;
$hasProductGroups = false;
@endphp
@foreach($recipePositionsFiltered as $selectedRecipePosition)
@if($lastIngredientGroup != $selectedRecipePosition->ingredient_group && !empty($selectedRecipePosition->ingredient_group))
@php $hasIngredientGroups = true; @endphp
<h5 class="mb-2 mt-2 ml-1"><strong>{{ $selectedRecipePosition->ingredient_group }}</strong></h5>
@endif
@if(boolval($userSettings['recipe_ingredients_group_by_product_group']) && $lastProductGroup != $selectedRecipePosition->product_group && !empty($selectedRecipePosition->product_group))
@php $hasProductGroups = true; @endphp
<h6 class="mb-2 mt-2 @if($hasIngredientGroups) ml-3 @else ml-1 @endif"><strong>{{ $selectedRecipePosition->product_group }}</strong></h6>
@endif
<li class="list-group-item px-0 @if($hasIngredientGroups && $hasProductGroups) ml-4 @elseif($hasIngredientGroups || $hasProductGroups) ml-2 @else ml-0 @endif">
@if($selectedRecipePosition->product_active == 0)
<div class="small text-muted font-italic">{{ $__t('Deactivated Product') }}</div>
@endif
@php
$product = FindObjectInArrayByPropertyValue($products, 'id', $selectedRecipePosition->product_id);
$productQuConversions = FindAllObjectsInArrayByPropertyValue($quantityUnitConversionsResolved, 'product_id', $product->id);
$productQuConversions = FindAllObjectsInArrayByPropertyValue($productQuConversions, 'from_qu_id', $product->qu_id_stock);
$productQuConversion = FindObjectInArrayByPropertyValue($productQuConversions, 'to_qu_id', $selectedRecipePosition->qu_id);
if ($productQuConversion)
{
$selectedRecipePosition->recipe_amount = $selectedRecipePosition->recipe_amount * $productQuConversion->factor;
}
@endphp
@if(!empty($selectedRecipePosition->recipe_variable_amount))
{{ $selectedRecipePosition->recipe_variable_amount }}
@else
<span class="locale-number locale-number-quantity-amount">@if($selectedRecipePosition->recipe_amount == round($selectedRecipePosition->recipe_amount, 2)){{ round($selectedRecipePosition->recipe_amount, 2) }}@else{{ $selectedRecipePosition->recipe_amount }}@endif</span>
@endif
{{ $__n($selectedRecipePosition->recipe_amount, FindObjectInArrayByPropertyValue($quantityUnits, 'id', $selectedRecipePosition->qu_id)->name, FindObjectInArrayByPropertyValue($quantityUnits, 'id', $selectedRecipePosition->qu_id)->name_plural) }} {{ FindObjectInArrayByPropertyValue($products, 'id', $selectedRecipePosition->product_id)->name }}
@if($selectedRecipePosition->need_fulfilled == 1)<i class="fas fa-check text-success"></i>@elseif($selectedRecipePosition->need_fulfilled_with_shopping_list == 1)<i class="fas fa-exclamation text-warning"></i>@else<i class="fas fa-times text-danger"></i>@endif
<span class="timeago-contextual">@if(FindObjectInArrayByPropertyValue($recipePositionsResolved, 'recipe_pos_id', $selectedRecipePosition->id)->need_fulfilled == 1) {{ $__t('Enough in stock') }} @else {{ $__t('Not enough in stock (not included in costs), %1$s missing, %2$s already on shopping list', round(FindObjectInArrayByPropertyValue($recipePositionsResolved, 'recipe_pos_id', $selectedRecipePosition->id)->missing_amount, 2), round(FindObjectInArrayByPropertyValue($recipePositionsResolved, 'recipe_pos_id', $selectedRecipePosition->id)->amount_on_shopping_list, 2)) }} @endif</span>
@if(!empty($selectedRecipePosition->recipe_variable_amount))
<div class="small text-muted font-italic">{{ $__t('Variable amount') }}</div>
@endif
@if(!empty($selectedRecipePosition->note))
<div class="text-muted">{!! nl2br($selectedRecipePosition->note) !!}</div>
@endif
</li>
@php $lastProductGroup = $selectedRecipePosition->product_group; @endphp
@php $lastIngredientGroup = $selectedRecipePosition->ingredient_group; @endphp
@endforeach
</ul>
</div>
@endif
<div class="tab-pane @if(count($recipePositionsFiltered) == 0) active @endif" id="prep-{{ $index }}" role="tabpanel">
<div class="mb-2 d-none d-print-block">
<h3 class="mb-0">{{ $__t('Preparation') }}</h3>
</div>
@if(!empty($recipe->description))
{!! $recipe->description !!}
@endif
</div> </div>
</div> </div>
</div> </div>
</div>
<div id="missing-recipe-pos-list" class="list-group d-none mt-3"> <div class="mb-4 @if(!empty($recipe->picture_file_name)) d-none @else d-flex @endif d-print-block justify-content-between align-items-center">
@foreach($recipePositionsResolved as $recipePos) <h1 class="card-title mb-0">{{ $recipe->name }}</h1>
@if(in_array($recipePos->recipe_id, $includedRecipeIdsAbsolute) && $recipePos->missing_amount > 0) <div class="card-icons d-flex flex-wrap justify-content-end flex-shrink-1 d-print-none">
<a href="#" class="list-group-item list-group-item-action list-group-item-primary missing-recipe-pos-select-button"> <a class="recipe-consume hide-when-embedded @if(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled == 0) disabled @endif"
<div class="form-check form-check-inline"> href="#"
<input class="form-check-input missing-recipe-pos-product-checkbox" type="checkbox" data-product-id="{{ $recipePos->product_id }}" checked> data-toggle="tooltip"
</div> title="{{ $__t('Consume all ingredients needed by this recipe') }}"
{{ FindObjectInArrayByPropertyValue($products, 'id', $recipePos->product_id)->name }} data-recipe-id="{{ $recipe->id }}"
data-recipe-name="{{ $recipe->name }}">
<i class="fas fa-utensils"></i>
</a> </a>
<a class="recipe-shopping-list hide-when-embedded @if(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled_with_shopping_list == 1) disabled @endif"
href="#"
data-toggle="tooltip"
title="{{ $__t('Put missing products on shopping list') }}"
data-recipe-id="{{ $recipe->id }}"
data-recipe-name="{{ $recipe->name }}">
<i class="fas fa-cart-plus"></i>
</a>
<a class="recipe-fullscreen hide-when-embedded"
href="#"
data-toggle="tooltip"
title="{{ $__t('Expand to fullscreen') }}">
<i class="fas fa-expand-arrows-alt"></i>
</a>
<a class="recipe-print hide-when-embedded PrintRecipe"
href="#"
data-toggle="tooltip"
title="{{ $__t('Print') }}">
<i class="fas fa-print"></i>
</a>
</div>
</div>
@php
$calories = FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->calories;
$costs = FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->costs;
@endphp
<div class="row ml-1">
@if(!empty($calories) && intval($calories) > 0)
<div class="col-6 col-xl-3">
<label>{{ $__t('Calories') }}</label>
<h3 class="locale-number locale-number-generic pt-0">{{ $calories }}</h3>
</div>
@endif @endif
@endforeach @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
<div class="col-5">
<label>{{ $__t('Costs') }}&nbsp;</label>
<i class="fas fa-question-circle"
data-toggle="tooltip"
title="{{ $__t('Based on the prices of the default consume rule which is "First expiring first, then first in first out"') }}"></i>
<h3 class="locale-number locale-number-currency pt-0">{{ $costs }}</h3>
</div>
@endif
@if($index == 0)
<div class="col-12 col-xl-4 d-print-none">
@include('components.numberpicker', array(
'id' => 'servings-scale',
'label' => 'Desired servings',
'min' => 1,
'value' => $recipe->desired_servings,
'invalidFeedback' => $__t('This cannot be lower than %s', '1'),
'additionalAttributes' => 'data-recipe-id="' . $recipe->id . '"',
'hint' => $__t('Base: %s', $recipe->base_servings)
))
</div>
@endif
</div>
@php
$recipePositionsFiltered = FindAllObjectsInArrayByPropertyValue($allRecipePositions[$recipe->id], 'recipe_id', $recipe->id);
@endphp
<ul class="nav nav-tabs grocy-tabs mb-3 d-print-none"
role="tablist">
@if(count($recipePositionsFiltered) > 0)
<li class="nav-item">
<a class="nav-link active"
data-toggle="tab"
href="#ingredients-{{ $index }}"
role="tab">{{ $__t('Ingredients') }}</a>
</li>
@endif
@if(!empty($recipe->description))
<li class="nav-item">
<a class="nav-link @if(count($recipePositionsFiltered) == 0) active @endif"
data-toggle="tab"
href="#prep-{{ $index }}"
role="tab">{{ $__t('Preparation') }}</a>
</li>
@endif
</ul>
<div class="tab-content grocy-tabs p-2 print">
@if(count($recipePositionsFiltered) > 0)
<div class="tab-pane active"
id="ingredients-{{ $index }}"
role="tabpanel">
<div class="mb-2 mt-3 d-none d-print-block">
<h3 class="mb-0">{{ $__t('Ingredients') }}</h3>
</div>
<ul class="list-group list-group-flush mb-5">
@php
$lastIngredientGroup = 'undefined';
$lastProductGroup = 'undefined';
$hasIngredientGroups = false;
$hasProductGroups = false;
@endphp
@foreach($recipePositionsFiltered as $selectedRecipePosition)
@if($lastIngredientGroup != $selectedRecipePosition->ingredient_group && !empty($selectedRecipePosition->ingredient_group))
@php $hasIngredientGroups = true; @endphp
<h5 class="mb-2 mt-2 ml-1"><strong>{{ $selectedRecipePosition->ingredient_group }}</strong></h5>
@endif
@if(boolval($userSettings['recipe_ingredients_group_by_product_group']) && $lastProductGroup != $selectedRecipePosition->product_group && !empty($selectedRecipePosition->product_group))
@php $hasProductGroups = true; @endphp
<h6 class="mb-2 mt-2 @if($hasIngredientGroups) ml-3 @else ml-1 @endif"><strong>{{ $selectedRecipePosition->product_group }}</strong></h6>
@endif
<li class="list-group-item px-0 @if($hasIngredientGroups && $hasProductGroups) ml-4 @elseif($hasIngredientGroups || $hasProductGroups) ml-2 @else ml-0 @endif">
@if($selectedRecipePosition->product_active == 0)
<div class="small text-muted font-italic">{{ $__t('Deactivated Product') }}</div>
@endif
@php
$product = FindObjectInArrayByPropertyValue($products, 'id', $selectedRecipePosition->product_id);
$productQuConversions = FindAllObjectsInArrayByPropertyValue($quantityUnitConversionsResolved, 'product_id', $product->id);
$productQuConversions = FindAllObjectsInArrayByPropertyValue($productQuConversions, 'from_qu_id', $product->qu_id_stock);
$productQuConversion = FindObjectInArrayByPropertyValue($productQuConversions, 'to_qu_id', $selectedRecipePosition->qu_id);
if ($productQuConversion)
{
$selectedRecipePosition->recipe_amount = $selectedRecipePosition->recipe_amount * $productQuConversion->factor;
}
@endphp
@if(!empty($selectedRecipePosition->recipe_variable_amount))
{{ $selectedRecipePosition->recipe_variable_amount }}
@else
<span class="locale-number locale-number-quantity-amount">@if($selectedRecipePosition->recipe_amount == round($selectedRecipePosition->recipe_amount, 2)){{ round($selectedRecipePosition->recipe_amount, 2) }}@else{{ $selectedRecipePosition->recipe_amount }}@endif</span>
@endif
{{ $__n($selectedRecipePosition->recipe_amount, FindObjectInArrayByPropertyValue($quantityUnits, 'id', $selectedRecipePosition->qu_id)->name, FindObjectInArrayByPropertyValue($quantityUnits, 'id', $selectedRecipePosition->qu_id)->name_plural) }} {{ FindObjectInArrayByPropertyValue($products, 'id', $selectedRecipePosition->product_id)->name }}
@if($selectedRecipePosition->need_fulfilled == 1)<i class="fas fa-check text-success"></i>@elseif($selectedRecipePosition->need_fulfilled_with_shopping_list == 1)<i class="fas fa-exclamation text-warning"></i>@else<i class="fas fa-times text-danger"></i>@endif
<span class="timeago-contextual">@if(FindObjectInArrayByPropertyValue($recipePositionsResolved, 'recipe_pos_id', $selectedRecipePosition->id)->need_fulfilled == 1) {{ $__t('Enough in stock') }} @else {{ $__t('Not enough in stock (not included in costs), %1$s missing, %2$s already on shopping list', round(FindObjectInArrayByPropertyValue($recipePositionsResolved, 'recipe_pos_id', $selectedRecipePosition->id)->missing_amount, 2), round(FindObjectInArrayByPropertyValue($recipePositionsResolved, 'recipe_pos_id', $selectedRecipePosition->id)->amount_on_shopping_list, 2)) }} @endif</span>
@if(!empty($selectedRecipePosition->recipe_variable_amount))
<div class="small text-muted font-italic">{{ $__t('Variable amount') }}</div>
@endif
@if(!empty($selectedRecipePosition->note))
<div class="text-muted">{!! nl2br($selectedRecipePosition->note) !!}</div>
@endif
</li>
@php $lastProductGroup = $selectedRecipePosition->product_group; @endphp
@php $lastIngredientGroup = $selectedRecipePosition->ingredient_group; @endphp
@endforeach
</ul>
</div>
@endif
<div class="tab-pane @if(count($recipePositionsFiltered) == 0) active @endif"
id="prep-{{ $index }}"
role="tabpanel">
<div class="mb-2 d-none d-print-block">
<h3 class="mb-0">{{ $__t('Preparation') }}</h3>
</div>
@if(!empty($recipe->description))
{!! $recipe->description !!}
@endif
</div>
</div>
</div> </div>
</div>
<div id="missing-recipe-pos-list"
class="list-group d-none mt-3">
@foreach($recipePositionsResolved as $recipePos)
@if(in_array($recipePos->recipe_id, $includedRecipeIdsAbsolute) && $recipePos->missing_amount > 0)
<a href="#"
class="list-group-item list-group-item-action list-group-item-primary missing-recipe-pos-select-button">
<div class="form-check form-check-inline">
<input class="form-check-input missing-recipe-pos-product-checkbox"
type="checkbox"
data-product-id="{{ $recipePos->product_id }}"
checked>
</div>
{{ FindObjectInArrayByPropertyValue($products, 'id', $recipePos->product_id)->name }}
</a>
@endif
@endforeach
</div>
@endforeach @endforeach
</div> </div>
</div> </div>

View File

@@ -17,12 +17,16 @@
<div class="form-group"> <div class="form-group">
<div class="checkbox"> <div class="checkbox">
<label for="recipe_ingredients_group_by_product_group"> <label for="recipe_ingredients_group_by_product_group">
<input type="checkbox" class="user-setting-control" id="recipe_ingredients_group_by_product_group" data-setting-key="recipe_ingredients_group_by_product_group"> {{ $__t('Group ingredients by their product group') }} <input type="checkbox"
class="user-setting-control"
id="recipe_ingredients_group_by_product_group"
data-setting-key="recipe_ingredients_group_by_product_group"> {{ $__t('Group ingredients by their product group') }}
</label> </label>
</div> </div>
</div> </div>
<a href="{{ $U('/recipes') }}" class="btn btn-success">{{ $__t('OK') }}</a> <a href="{{ $U('/recipes') }}"
class="btn btn-success">{{ $__t('OK') }}</a>
</div> </div>
</div> </div>
@stop @stop

View File

@@ -5,20 +5,23 @@
@section('viewJsName', 'shoppinglist') @section('viewJsName', 'shoppinglist')
@push('pageScripts') @push('pageScripts')
<script src="{{ $U('/node_modules/datatables.net-rowgroup/js/dataTables.rowGroup.min.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/node_modules/datatables.net-rowgroup/js/dataTables.rowGroup.min.js?v=', true) }}{{ $version }}"></script>
<script src="{{ $U('/node_modules/datatables.net-rowgroup-bs4/js/rowGroup.bootstrap4.min.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/node_modules/datatables.net-rowgroup-bs4/js/rowGroup.bootstrap4.min.js?v=', true) }}{{ $version }}"></script>
<script src="{{ $U('/viewjs/purchase.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/viewjs/purchase.js?v=', true) }}{{ $version }}"></script>
@endpush @endpush
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}"
<link href="{{ $U('/node_modules/datatables.net-rowgroup-bs4/css/rowGroup.bootstrap4.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> rel="stylesheet">
<link href="{{ $U('/node_modules/datatables.net-rowgroup-bs4/css/rowGroup.bootstrap4.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
<style> <style>
tr.dtrg-group { tr.dtrg-group {
cursor: pointer; cursor: pointer;
} }
</style>
</style>
@endpush @endpush
@section('content') @section('content')
@@ -27,70 +30,91 @@
<div class="row"> <div class="row">
<h2 class="col-sm-12 col-md-6 mb-2 title">@yield('title')</h2> <h2 class="col-sm-12 col-md-6 mb-2 title">@yield('title')</h2>
@if(GROCY_FEATURE_FLAG_SHOPPINGLIST_MULTIPLE_LISTS) @if(GROCY_FEATURE_FLAG_SHOPPINGLIST_MULTIPLE_LISTS)
<div class="col-sm-12 col-md-6 d-flex align-items-end flex-wrap"> <div class="col-sm-12 col-md-6 d-flex align-items-end flex-wrap">
<div class="d-inline-block flex-grow-1 pr-1 mb-1"> <div class="d-inline-block flex-grow-1 pr-1 mb-1">
<select class="form-control form-control-sm" id="selected-shopping-list"> <select class="form-control form-control-sm"
@foreach($shoppingLists as $shoppingList) id="selected-shopping-list">
<option @if($shoppingList->id == $selectedShoppingListId) selected="selected" @endif value="{{ $shoppingList->id }}">{{ $shoppingList->name }}</option> @foreach($shoppingLists as $shoppingList)
@endforeach <option @if($shoppingList->id == $selectedShoppingListId) selected="selected" @endif value="{{ $shoppingList->id }}">{{ $shoppingList->name }}</option>
</select> @endforeach
</div> </select>
<div class="d-inline-block mb-1"> </div>
<a class="btn btn-outline-dark btn-sm responsive-button" href="{{ $U('/shoppinglist/new') }}"> <div class="d-inline-block mb-1">
{{ $__t('New shopping list') }} <a class="btn btn-outline-dark btn-sm responsive-button"
</a> href="{{ $U('/shoppinglist/new') }}">
<a id="delete-selected-shopping-list" class="btn btn-outline-danger btn-sm responsive-button @if($selectedShoppingListId == 1) disabled @endif" href="#"> {{ $__t('New shopping list') }}
{{ $__t('Delete shopping list') }} </a>
</a> <a id="delete-selected-shopping-list"
<a id="print-shopping-list-button" class="btn btn-outline-dark btn-sm responsive-button" href="#"> class="btn btn-outline-danger btn-sm responsive-button @if($selectedShoppingListId == 1) disabled @endif"
{{ $__t('Print') }} href="#">
</a> {{ $__t('Delete shopping list') }}
<!--<div class="dropdown d-inline-block"> </a>
<a id="print-shopping-list-button"
class="btn btn-outline-dark btn-sm responsive-button"
href="#">
{{ $__t('Print') }}
</a>
<!--<div class="dropdown d-inline-block">
<button class="btn btn-outline-dark responsive-button dropdown-toggle" data-toggle="dropdown"><i class="fas fa-file-export"></i> {{ $__t('Output') }}</button> <button class="btn btn-outline-dark responsive-button dropdown-toggle" data-toggle="dropdown"><i class="fas fa-file-export"></i> {{ $__t('Output') }}</button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a id="print-shopping-list-button" class="dropdown-item" href="#"><i class="fas fa-print"></i> {{ $__t('Print') }}</a> <a id="print-shopping-list-button" class="dropdown-item" href="#"><i class="fas fa-print"></i> {{ $__t('Print') }}</a>
</div> </div>
</div>--> </div>-->
</div>
</div> </div>
</div>
@else @else
<input type="hidden" name="selected-shopping-list" id="selected-shopping-list" value="1"> <input type="hidden"
name="selected-shopping-list"
id="selected-shopping-list"
value="1">
@endif @endif
</div> </div>
<hr> <hr>
<p data-status-filter="belowminstockamount" class="normal-message status-filter-message responsive-button">{{ $__n(count($missingProducts), '%s product is below defined min. stock amount', '%s products are below defined min. stock amount') }}</p> <p data-status-filter="belowminstockamount"
class="normal-message status-filter-message responsive-button">{{ $__n(count($missingProducts), '%s product is below defined min. stock amount', '%s products are below defined min. stock amount') }}</p>
</div> </div>
</div> </div>
<div class="row mt-3 d-print-none hide-on-fullscreen-card"> <div class="row mt-3 d-print-none hide-on-fullscreen-card">
<div class="col-md-12 mb-2"> <div class="col-md-12 mb-2">
<a class="btn btn-primary responsive-button btn-sm mb-1" href="{{ $U('/shoppinglistitem/new?list=' . $selectedShoppingListId) }}"> <a class="btn btn-primary responsive-button btn-sm mb-1"
href="{{ $U('/shoppinglistitem/new?list=' . $selectedShoppingListId) }}">
{{ $__t('Add item') }} {{ $__t('Add item') }}
</a> </a>
<a id="clear-shopping-list" class="btn btn-outline-danger btn-sm mb-1 responsive-button @if($listItems->count() == 0) disabled @endif" href="#"> <a id="clear-shopping-list"
class="btn btn-outline-danger btn-sm mb-1 responsive-button @if($listItems->count() == 0) disabled @endif"
href="#">
{{ $__t('Clear list') }} {{ $__t('Clear list') }}
</a> </a>
<a id="add-all-items-to-stock-button" class="btn btn-outline-primary btn-sm mb-1 responsive-button" href="#"> <a id="add-all-items-to-stock-button"
class="btn btn-outline-primary btn-sm mb-1 responsive-button"
href="#">
{{ $__t('Add all list items to stock') }} {{ $__t('Add all list items to stock') }}
</a> </a>
<a id="add-products-below-min-stock-amount" class="btn btn-outline-primary btn-sm mb-1 responsive-button" href="#"> <a id="add-products-below-min-stock-amount"
class="btn btn-outline-primary btn-sm mb-1 responsive-button"
href="#">
{{ $__t('Add products that are below defined min. stock amount') }} {{ $__t('Add products that are below defined min. stock amount') }}
</a> </a>
</div> </div>
<div class="col-xs-12 col-md-5"> <div class="col-xs-12 col-md-5">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
<div class="col-xs-12 col-md-4 col-lg-5"> <div class="col-xs-12 col-md-4 col-lg-5">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-filter"></i></span> <span class="input-group-text"><i class="fas fa-filter"></i></span>
</div> </div>
<select class="form-control" id="status-filter"> <select class="form-control"
id="status-filter">
<option value="all">{{ $__t('All') }}</option> <option value="all">{{ $__t('All') }}</option>
<option value="belowminstockamount">{{ $__t('Below min. stock amount') }}</option> <option value="belowminstockamount">{{ $__t('Below min. stock amount') }}</option>
<option value="xxUNDONExx">{{ $__t('Only undone items') }}</option> <option value="xxUNDONExx">{{ $__t('Only undone items') }}</option>
@@ -98,18 +122,24 @@
</div> </div>
</div> </div>
<div class="col-xs-12 col-md-3 col-lg-2 mb-3"> <div class="col-xs-12 col-md-3 col-lg-2 mb-3">
<a id="shopping-list-compact-view-button" class="btn btn-outline-dark responsive-button switch-view-mode-button w-100" href="#"> <a id="shopping-list-compact-view-button"
class="btn btn-outline-dark responsive-button switch-view-mode-button w-100"
href="#">
{{ $__t('Compact view') }} {{ $__t('Compact view') }}
</a> </a>
</div> </div>
</div> </div>
<div id="shoppinglist-main" class="row d-print-none"> <div id="shoppinglist-main"
class="row d-print-none">
<div class="@if(boolval($userSettings['shopping_list_show_calendar'])) col-xs-12 col-md-8 @else col-12 @endif pb-3"> <div class="@if(boolval($userSettings['shopping_list_show_calendar'])) col-xs-12 col-md-8 @else col-12 @endif pb-3">
<a id="shopping-list-normal-view-button" class="btn btn-outline-dark btn-block switch-view-mode-button d-none" href="#"> <a id="shopping-list-normal-view-button"
class="btn btn-outline-dark btn-block switch-view-mode-button d-none"
href="#">
{{ $__t('Normal view') }} {{ $__t('Normal view') }}
</a> </a>
<table id="shoppinglist-table" class="table table-sm table-striped dt-responsive"> <table id="shoppinglist-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -119,30 +149,43 @@
<th class="d-none">Hidden status</th> <th class="d-none">Hidden status</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
</thead> </thead>
<tbody class="d-none"> <tbody class="d-none">
@foreach($listItems as $listItem) @foreach($listItems as $listItem)
<tr id="shoppinglistitem-{{ $listItem->id }}-row" class="@if(FindObjectInArrayByPropertyValue($missingProducts, 'id', $listItem->product_id) !== null) table-info @endif @if($listItem->done == 1) text-muted text-strike-through @endif"> <tr id="shoppinglistitem-{{ $listItem->id }}-row"
class="@if(FindObjectInArrayByPropertyValue($missingProducts, 'id', $listItem->product_id) !== null) table-info @endif @if($listItem->done == 1) text-muted text-strike-through @endif">
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-success btn-sm order-listitem-button" href="#" <a class="btn btn-success btn-sm order-listitem-button"
href="#"
data-item-id="{{ $listItem->id }}" data-item-id="{{ $listItem->id }}"
data-item-done="{{ $listItem->done }}" data-item-done="{{ $listItem->done }}"
data-toggle="tooltip" data-placement="right" title="{{ $__t('Mark this item as done') }}"> data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Mark this item as done') }}">
<i class="fas fa-check"></i> <i class="fas fa-check"></i>
</a> </a>
<a class="btn btn-sm btn-info" href="{{ $U('/shoppinglistitem/') . $listItem->id . '?list=' . $selectedShoppingListId }}" <a class="btn btn-sm btn-info"
data-toggle="tooltip" data-placement="right" title="{{ $__t('Edit this item') }}"> href="{{ $U('/shoppinglistitem/') . $listItem->id . '?list=' . $selectedShoppingListId }}"
data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Edit this item') }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-sm btn-danger shoppinglist-delete-button" href="#" data-shoppinglist-id="{{ $listItem->id }}" <a class="btn btn-sm btn-danger shoppinglist-delete-button"
data-toggle="tooltip" data-placement="right" title="{{ $__t('Delete this item') }}"> href="#"
data-shoppinglist-id="{{ $listItem->id }}"
data-toggle="tooltip"
data-placement="right"
title="{{ $__t('Delete this item') }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
<a class="btn btn-sm btn-primary @if(empty($listItem->product_id)) disabled @else shopping-list-stock-add-workflow-list-item-button @endif" href="{{ $U('/purchase?embedded&flow=shoppinglistitemtostock&product=') }}{{ $listItem->product_id }}&amount={{ $listItem->amount }}&listitemid={{ $listItem->id }}" @if(!empty($listItem->product_id)) data-toggle="tooltip" title="{{ $__t('Add %1$s of %2$s to stock', $listItem->amount . ' ' . $__n($listItem->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->qu_id_purchase)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->qu_id_purchase)->name_plural), FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->name, $listItem->amount) }}" @endif> <a class="btn btn-sm btn-primary @if(empty($listItem->product_id)) disabled @else shopping-list-stock-add-workflow-list-item-button @endif"
href="{{ $U('/purchase?embedded&flow=shoppinglistitemtostock&product=') }}{{ $listItem->product_id }}&amount={{ $listItem->amount }}&listitemid={{ $listItem->id }}"
@if(!empty($listItem->product_id)) data-toggle="tooltip" title="{{ $__t('Add %1$s of %2$s to stock', $listItem->amount . ' ' . $__n($listItem->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->qu_id_purchase)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->qu_id_purchase)->name_plural), FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->name, $listItem->amount) }}" @endif>
<i class="fas fa-box"></i> <i class="fas fa-box"></i>
</a> </a>
</td> </td>
@@ -155,14 +198,15 @@
<td class="d-none"> <td class="d-none">
@if(!empty(FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->product_group_id)) {{ FindObjectInArrayByPropertyValue($productGroups, 'id', FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->product_group_id)->name }} @else <span class="font-italic font-weight-light">{{ $__t('Ungrouped') }}</span> @endif @if(!empty(FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->product_group_id)) {{ FindObjectInArrayByPropertyValue($productGroups, 'id', FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->product_group_id)->name }} @else <span class="font-italic font-weight-light">{{ $__t('Ungrouped') }}</span> @endif
</td> </td>
<td id="shoppinglistitem-{{ $listItem->id }}-status-info" class="d-none"> <td id="shoppinglistitem-{{ $listItem->id }}-status-info"
class="d-none">
@if(FindObjectInArrayByPropertyValue($missingProducts, 'id', $listItem->product_id) !== null) belowminstockamount @endif @if(FindObjectInArrayByPropertyValue($missingProducts, 'id', $listItem->product_id) !== null) belowminstockamount @endif
@if($listItem->done != 1) xxUNDONExx @endif @if($listItem->done != 1) xxUNDONExx @endif
</td> </td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $listItem->product_id) 'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $listItem->product_id)
)) ))
</tr> </tr>
@@ -179,24 +223,40 @@
<div class="@if(boolval($userSettings['shopping_list_show_calendar'])) col-xs-12 col-md-8 @else col-12 @endif d-print-none pt-2"> <div class="@if(boolval($userSettings['shopping_list_show_calendar'])) col-xs-12 col-md-8 @else col-12 @endif d-print-none pt-2">
<div class="form-group"> <div class="form-group">
<label class="text-larger font-weight-bold" for="notes">{{ $__t('Notes') }}</label> <label class="text-larger font-weight-bold"
<a id="save-description-button" class="btn btn-success btn-sm ml-1 mb-2" href="#">{{ $__t('Save') }}</a> for="notes">{{ $__t('Notes') }}</label>
<a id="clear-description-button" class="btn btn-danger btn-sm ml-1 mb-2" href="#">{{ $__t('Clear') }}</a> <a id="save-description-button"
<textarea class="form-control wysiwyg-editor" id="description" name="description">{{ FindObjectInArrayByPropertyValue($shoppingLists, 'id', $selectedShoppingListId)->description }}</textarea> class="btn btn-success btn-sm ml-1 mb-2"
href="#">{{ $__t('Save') }}</a>
<a id="clear-description-button"
class="btn btn-danger btn-sm ml-1 mb-2"
href="#">{{ $__t('Clear') }}</a>
<textarea class="form-control wysiwyg-editor"
id="description"
name="description">{{ FindObjectInArrayByPropertyValue($shoppingLists, 'id', $selectedShoppingListId)->description }}</textarea>
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="shopping-list-stock-add-workflow-modal" tabindex="-1"> <div class="modal fade"
id="shopping-list-stock-add-workflow-modal"
tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content text-center"> <div class="modal-content text-center">
<div class="modal-body"> <div class="modal-body">
<iframe id="shopping-list-stock-add-workflow-purchase-form-frame" class="embed-responsive" src=""></iframe> <iframe id="shopping-list-stock-add-workflow-purchase-form-frame"
class="embed-responsive"
src=""></iframe>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<span id="shopping-list-stock-add-workflow-purchase-item-count" class="d-none mr-auto"></span> <span id="shopping-list-stock-add-workflow-purchase-item-count"
<button id="shopping-list-stock-add-workflow-skip-button" type="button" class="btn btn-primary"><i class="fas fa-angle-double-right"></i> {{ $__t('Skip') }}</button> class="d-none mr-auto"></span>
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ $__t('Close') }}</button> <button id="shopping-list-stock-add-workflow-skip-button"
type="button"
class="btn btn-primary"><i class="fas fa-angle-double-right"></i> {{ $__t('Skip') }}</button>
<button type="button"
class="btn btn-secondary"
data-dismiss="modal">{{ $__t('Close') }}</button>
</div> </div>
</div> </div>
</div> </div>
@@ -204,7 +264,9 @@
<div class="d-none d-print-block"> <div class="d-none d-print-block">
<h1 class="text-center"> <h1 class="text-center">
<img src="{{ $U('/img/grocy_logo.svg?v=', true) }}{{ $version }}" height="30" class="d-print-flex mx-auto"> <img src="{{ $U('/img/grocy_logo.svg?v=', true) }}{{ $version }}"
height="30"
class="d-print-flex mx-auto">
{{ $__t("Shopping list") }} {{ $__t("Shopping list") }}
</h1> </h1>
@if (FindObjectInArrayByPropertyValue($shoppingLists, 'id', $selectedShoppingListId)->name != $__t("Shopping list")) @if (FindObjectInArrayByPropertyValue($shoppingLists, 'id', $selectedShoppingListId)->name != $__t("Shopping list"))
@@ -225,7 +287,7 @@
<th>{{ $__t('Amount') }}</th> <th>{{ $__t('Amount') }}</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
@@ -241,8 +303,8 @@
</td> </td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $listItem->product_id) 'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $listItem->product_id)
)) ))
</tr> </tr>

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit shopping list')) @section('title', $__t('Edit shopping list'))
@else @else
@section('title', $__t('Create shopping list')) @section('title', $__t('Create shopping list'))
@endif @endif
@section('viewJsName', 'shoppinglistform') @section('viewJsName', 'shoppinglistform')
@@ -17,21 +17,32 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<script>Grocy.EditMode = '{{ $mode }}';</script> <script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $shoppingList->id }};</script> <script>
Grocy.EditObjectId = {{ $shoppingList->id }};
</script>
@endif @endif
<form id="shopping-list-form" novalidate> <form id="shopping-list-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Name') }}</label> <label for="name">{{ $__t('Name') }}</label>
<input type="text" class="form-control" required id="name" name="name" value="@if($mode == 'edit'){{ $shoppingList->name }}@endif"> <input type="text"
class="form-control"
required
id="name"
name="name"
value="@if($mode == 'edit'){{ $shoppingList->name }}@endif">
<div class="invalid-feedback">{{ $__t('A name is required') }}</div> <div class="invalid-feedback">{{ $__t('A name is required') }}</div>
</div> </div>
<button id="save-shopping-list-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-shopping-list-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit shopping list item')) @section('title', $__t('Edit shopping list item'))
@else @else
@section('title', $__t('Create shopping list item')) @section('title', $__t('Create shopping list item'))
@endif @endif
@section('viewJsName', 'shoppinglistitemform') @section('viewJsName', 'shoppinglistitemform')
@@ -17,52 +17,68 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-6 col-xl-4 pb-3"> <div class="col-xs-12 col-md-6 col-xl-4 pb-3">
<script>Grocy.EditMode = '{{ $mode }}';</script> <script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $listItem->id }};</script> <script>
Grocy.EditObjectId = {{ $listItem->id }};
</script>
@endif @endif
<form id="shoppinglist-form" novalidate> <form id="shoppinglist-form"
novalidate>
@if(GROCY_FEATURE_FLAG_SHOPPINGLIST_MULTIPLE_LISTS) @if(GROCY_FEATURE_FLAG_SHOPPINGLIST_MULTIPLE_LISTS)
<div class="form-group"> <div class="form-group">
<label for="shopping_list_id">{{ $__t('Shopping list') }}</label> <label for="shopping_list_id">{{ $__t('Shopping list') }}</label>
<select class="form-control" id="shopping_list_id" name="shopping_list_id"> <select class="form-control"
id="shopping_list_id"
name="shopping_list_id">
@foreach($shoppingLists as $shoppingList) @foreach($shoppingLists as $shoppingList)
<option @if($mode == 'edit' && $shoppingList->id == $listItem->shopping_list_id) selected="selected" @endif value="{{ $shoppingList->id }}">{{ $shoppingList->name }}</option> <option @if($mode=='edit'
&&
$shoppingList->id == $listItem->shopping_list_id) selected="selected" @endif value="{{ $shoppingList->id }}">{{ $shoppingList->name }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
@else @else
<input type="hidden" id="shopping_list_id" name="shopping_list_id" value="1"> <input type="hidden"
id="shopping_list_id"
name="shopping_list_id"
value="1">
@endif @endif
@php if($mode == 'edit') { $productId = $listItem->product_id; } else { $productId = ''; } @endphp @php if($mode == 'edit') { $productId = $listItem->product_id; } else { $productId = ''; } @endphp
@include('components.productpicker', array( @include('components.productpicker', array(
'products' => $products, 'products' => $products,
'nextInputSelector' => '#amount', 'nextInputSelector' => '#amount',
'isRequired' => false, 'isRequired' => false,
'prefillById' => $productId 'prefillById' => $productId
)) ))
@php if($mode == 'edit') { $value = $listItem->amount; } else { $value = 1; } @endphp @php if($mode == 'edit') { $value = $listItem->amount; } else { $value = 1; } @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'amount', 'id' => 'amount',
'label' => 'Amount', 'label' => 'Amount',
'hintId' => 'amount_qu_unit', 'hintId' => 'amount_qu_unit',
'min' => 0.01, 'min' => 0.01,
'step' => 0.01, 'step' => 0.01,
'value' => $value, 'value' => $value,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '0.01') 'invalidFeedback' => $__t('The amount cannot be lower than %s', '0.01')
)) ))
<div class="form-group"> <div class="form-group">
<label for="note">{{ $__t('Note') }}</label> <label for="note">{{ $__t('Note') }}</label>
<textarea class="form-control" rows="2" id="note" name="note">@if($mode == 'edit'){{ $listItem->note }}@endif</textarea> <textarea class="form-control"
rows="2"
id="note"
name="note">@if($mode == 'edit'){{ $listItem->note }}@endif</textarea>
</div> </div>
<button id="save-shoppinglist-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-shoppinglist-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>

View File

@@ -17,14 +17,22 @@
<div class="form-group"> <div class="form-group">
<div class="checkbox"> <div class="checkbox">
<label for="shopping-list-show-calendar"> <label for="shopping-list-show-calendar">
<input type="checkbox" class="user-setting-control" id="shopping-list-show-calendar" name="shopping-list-show-calendar" data-setting-key="shopping_list_show_calendar"> {{ $__t('Show a month-view calendar') }} <input type="checkbox"
class="user-setting-control"
id="shopping-list-show-calendar"
name="shopping-list-show-calendar"
data-setting-key="shopping_list_show_calendar"> {{ $__t('Show a month-view calendar') }}
</label> </label>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="checkbox"> <div class="checkbox">
<label for="shopping-list-disable-auto-compact-view-on-mobile"> <label for="shopping-list-disable-auto-compact-view-on-mobile">
<input type="checkbox" class="user-setting-control" id="shopping-list-disable-auto-compact-view-on-mobile" name="shopping-list-disable-auto-compact-view-on-mobile" data-setting-key="shopping_list_disable_auto_compact_view_on_mobile"> {{ $__t('Don\'t automatically switch to the compact view on mobile devices') }} <input type="checkbox"
class="user-setting-control"
id="shopping-list-disable-auto-compact-view-on-mobile"
name="shopping-list-disable-auto-compact-view-on-mobile"
data-setting-key="shopping_list_disable_auto_compact_view_on_mobile"> {{ $__t('Don\'t automatically switch to the compact view on mobile devices') }}
</label> </label>
</div> </div>
</div> </div>
@@ -33,12 +41,17 @@
<div class="form-group"> <div class="form-group">
<div class="checkbox"> <div class="checkbox">
<label for="shopping-list-to-stock-workflow-auto-submit-when-prefilled"> <label for="shopping-list-to-stock-workflow-auto-submit-when-prefilled">
<input type="checkbox" class="user-setting-control" id="shopping-list-to-stock-workflow-auto-submit-when-prefilled" name="shopping-list-to-stock-workflow-auto-submit-when-prefilled" data-setting-key="shopping_list_to_stock_workflow_auto_submit_when_prefilled"> {{ $__t('Automatically do the booking using the last price and the amount of the shopping list item, if the product has "Default best before days" set') }} <input type="checkbox"
class="user-setting-control"
id="shopping-list-to-stock-workflow-auto-submit-when-prefilled"
name="shopping-list-to-stock-workflow-auto-submit-when-prefilled"
data-setting-key="shopping_list_to_stock_workflow_auto_submit_when_prefilled"> {{ $__t('Automatically do the booking using the last price and the amount of the shopping list item, if the product has "Default best before days" set') }}
</label> </label>
</div> </div>
</div> </div>
<a href="{{ $U('/shoppinglist') }}" class="btn btn-success">{{ $__t('OK') }}</a> <a href="{{ $U('/shoppinglist') }}"
class="btn btn-success">{{ $__t('OK') }}</a>
</div> </div>
</div> </div>
@stop @stop

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit store')) @section('title', $__t('Edit store'))
@else @else
@section('title', $__t('Create store')) @section('title', $__t('Create store'))
@endif @endif
@section('viewJsName', 'shoppinglocationform') @section('viewJsName', 'shoppinglocationform')
@@ -17,31 +17,45 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<script>Grocy.EditMode = '{{ $mode }}';</script> <script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $shoppinglocation->id }};</script> <script>
Grocy.EditObjectId = {{ $shoppinglocation->id }};
</script>
@endif @endif
<form id="shoppinglocation-form" novalidate> <form id="shoppinglocation-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Name') }}</label> <label for="name">{{ $__t('Name') }}</label>
<input type="text" class="form-control" required id="name" name="name" value="@if($mode == 'edit'){{ $shoppinglocation->name }}@endif"> <input type="text"
class="form-control"
required
id="name"
name="name"
value="@if($mode == 'edit'){{ $shoppinglocation->name }}@endif">
<div class="invalid-feedback">{{ $__t('A name is required') }}</div> <div class="invalid-feedback">{{ $__t('A name is required') }}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="description">{{ $__t('Description') }}</label> <label for="description">{{ $__t('Description') }}</label>
<textarea class="form-control" rows="2" id="description" name="description">@if($mode == 'edit'){{ $shoppinglocation->description }}@endif</textarea> <textarea class="form-control"
rows="2"
id="description"
name="description">@if($mode == 'edit'){{ $shoppinglocation->description }}@endif</textarea>
</div> </div>
@include('components.userfieldsform', array( @include('components.userfieldsform', array(
'userfields' => $userfields, 'userfields' => $userfields,
'entity' => 'shopping_locations' 'entity' => 'shopping_locations'
)) ))
<button id="save-shopping-location-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-shopping-location-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>

View File

@@ -10,8 +10,9 @@
<div class="title-related-links"> <div class="title-related-links">
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<div class="related-links"> <div class="related-links">
<a class="btn btn-outline-secondary" href="{{ $U('/userfields?entity=shoppinglocations') }}"> <a class="btn btn-outline-secondary"
{{ $__t('Configure userfields') }} href="{{ $U('/userfields?entity=shoppinglocations') }}">
{{ $__t('Configure userfields') }}
</a> </a>
</div> </div>
</div> </div>
@@ -21,7 +22,8 @@
<div class="row mt-3"> <div class="row mt-3">
<div class="col-xs-12 col-md-2 col-xl-1"> <div class="col-xs-12 col-md-2 col-xl-1">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3" href="{{ $U('/shoppinglocation/new') }}"> <a class="btn btn-primary btn-sm responsive-button w-100 mb-3"
href="{{ $U('/shoppinglocation/new') }}">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
@@ -30,16 +32,20 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="shoppinglocations-table" class="table table-sm table-striped dt-responsive"> <table id="shoppinglocations-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -47,7 +53,7 @@
<th>{{ $__t('Description') }}</th> <th>{{ $__t('Description') }}</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
@@ -56,10 +62,14 @@
@foreach($shoppinglocations as $shoppinglocation) @foreach($shoppinglocations as $shoppinglocation)
<tr> <tr>
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-info btn-sm" href="{{ $U('/shoppinglocation/') }}{{ $shoppinglocation->id }}"> <a class="btn btn-info btn-sm"
href="{{ $U('/shoppinglocation/') }}{{ $shoppinglocation->id }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-danger btn-sm shoppinglocation-delete-button" href="#" data-shoppinglocation-id="{{ $shoppinglocation->id }}" data-shoppinglocation-name="{{ $shoppinglocation->name }}"> <a class="btn btn-danger btn-sm shoppinglocation-delete-button"
href="#"
data-shoppinglocation-id="{{ $shoppinglocation->id }}"
data-shoppinglocation-name="{{ $shoppinglocation->name }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
</td> </td>
@@ -71,8 +81,8 @@
</td> </td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $shoppinglocation->id) 'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $shoppinglocation->id)
)) ))
</tr> </tr>

View File

@@ -4,11 +4,12 @@
@section('viewJsName', 'stockentries') @section('viewJsName', 'stockentries')
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
@endpush @endpush
@push('pageScripts') @push('pageScripts')
<script src="{{ $U('/viewjs/purchase.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/viewjs/purchase.js?v=', true) }}{{ $version }}"></script>
@endpush @endpush
@section('content') @section('content')
@@ -18,15 +19,16 @@
</div> </div>
<div class="col"> <div class="col">
@include('components.productpicker', array( @include('components.productpicker', array(
'products' => $products, 'products' => $products,
'disallowAllProductWorkflows' => true 'disallowAllProductWorkflows' => true
)) ))
</div> </div>
</div> </div>
<hr> <hr>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="stockentries-table" class="table table-sm table-striped dt-responsive"> <table id="stockentries-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -45,15 +47,24 @@
<th>{{ $__t('Purchased date') }}</th> <th>{{ $__t('Purchased date') }}</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
</thead> </thead>
<tbody class="d-none"> <tbody class="d-none">
@foreach($stockEntries as $stockEntry) @foreach($stockEntries as $stockEntry)
<tr id="stock-{{ $stockEntry->id }}-row" class="@if(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING && $stockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime('-1 days')) && $stockEntry->amount > 0) table-danger @elseif(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING && $stockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime("+$nextXDays days")) && $stockEntry->amount > 0) table-warning @endif"> <tr id="stock-{{ $stockEntry->id }}-row"
class="@if(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING && $stockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime('-1 days')) && $stockEntry->amount > 0) table-danger @elseif(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING && $stockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime("
+$nextXDays
days"))
&&
$stockEntry->amount > 0) table-warning @endif">
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-danger btn-sm stock-consume-button" href="#" data-toggle="tooltip" data-placement="left" title="{{ $__t('Consume this stock entry') }}" <a class="btn btn-danger btn-sm stock-consume-button"
href="#"
data-toggle="tooltip"
data-placement="left"
title="{{ $__t('Consume this stock entry') }}"
data-product-id="{{ $stockEntry->product_id }}" data-product-id="{{ $stockEntry->product_id }}"
data-stock-id="{{ $stockEntry->stock_id }}" data-stock-id="{{ $stockEntry->stock_id }}"
data-stockrow-id="{{ $stockEntry->id }}" data-stockrow-id="{{ $stockEntry->id }}"
@@ -64,7 +75,11 @@
<i class="fas fa-utensils"></i> <i class="fas fa-utensils"></i>
</a> </a>
@if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING)
<a class="btn btn-success btn-sm product-open-button @if($stockEntry->open == 1) disabled @endif" href="#" data-toggle="tooltip" data-placement="left" title="{{ $__t('Mark this stock entry as open') }}" <a class="btn btn-success btn-sm product-open-button @if($stockEntry->open == 1) disabled @endif"
href="#"
data-toggle="tooltip"
data-placement="left"
title="{{ $__t('Mark this stock entry as open') }}"
data-product-id="{{ $stockEntry->product_id }}" data-product-id="{{ $stockEntry->product_id }}"
data-product-name="{{ FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name }}" data-product-name="{{ FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name }}"
data-product-qu-name="{{ FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name }}" data-product-qu-name="{{ FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name }}"
@@ -73,44 +88,69 @@
<i class="fas fa-box-open"></i> <i class="fas fa-box-open"></i>
</a> </a>
@endif @endif
<a class="btn btn-info btn-sm show-as-dialog-link" href="{{ $U('/stockentry/' . $stockEntry->id . '?embedded') }}" data-toggle="tooltip" data-placement="left" title="{{ $__t('Edit stock entry') }}"> <a class="btn btn-info btn-sm show-as-dialog-link"
href="{{ $U('/stockentry/' . $stockEntry->id . '?embedded') }}"
data-toggle="tooltip"
data-placement="left"
title="{{ $__t('Edit stock entry') }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<div class="dropdown d-inline-block"> <div class="dropdown d-inline-block">
<button class="btn btn-sm btn-light text-secondary" type="button" data-toggle="dropdown"> <button class="btn btn-sm btn-light text-secondary"
type="button"
data-toggle="dropdown">
<i class="fas fa-ellipsis-v"></i> <i class="fas fa-ellipsis-v"></i>
</button> </button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item show-as-dialog-link" type="button" href="{{ $U('/shoppinglistitem/new?embedded&updateexistingproduct&product=' . $stockEntry->product_id ) }}"> <a class="dropdown-item show-as-dialog-link"
type="button"
href="{{ $U('/shoppinglistitem/new?embedded&updateexistingproduct&product=' . $stockEntry->product_id ) }}">
<i class="fas fa-shopping-cart"></i> {{ $__t('Add to shopping list') }} <i class="fas fa-shopping-cart"></i> {{ $__t('Add to shopping list') }}
</a> </a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item show-as-dialog-link" type="button" href="{{ $U('/purchase?embedded&product=' . $stockEntry->product_id ) }}"> <a class="dropdown-item show-as-dialog-link"
type="button"
href="{{ $U('/purchase?embedded&product=' . $stockEntry->product_id ) }}">
<i class="fas fa-shopping-cart"></i> {{ $__t('Purchase') }} <i class="fas fa-shopping-cart"></i> {{ $__t('Purchase') }}
</a> </a>
<a class="dropdown-item show-as-dialog-link" type="button" href="{{ $U('/consume?embedded&product=' . $stockEntry->product_id . '&locationId=' . $stockEntry->location_id . '&stockId=' . $stockEntry->stock_id) }}"> <a class="dropdown-item show-as-dialog-link"
type="button"
href="{{ $U('/consume?embedded&product=' . $stockEntry->product_id . '&locationId=' . $stockEntry->location_id . '&stockId=' . $stockEntry->stock_id) }}">
<i class="fas fa-utensils"></i> {{ $__t('Consume') }} <i class="fas fa-utensils"></i> {{ $__t('Consume') }}
</a> </a>
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
<a class="dropdown-item show-as-dialog-link" type="button" href="{{ $U('/transfer?embedded&product=' . $stockEntry->product_id . '&locationId=' . $stockEntry->location_id . '&stockId=' . $stockEntry->stock_id) }}"> <a class="dropdown-item show-as-dialog-link"
type="button"
href="{{ $U('/transfer?embedded&product=' . $stockEntry->product_id . '&locationId=' . $stockEntry->location_id . '&stockId=' . $stockEntry->stock_id) }}">
<i class="fas fa-exchange-alt"></i> {{ $__t('Transfer') }} <i class="fas fa-exchange-alt"></i> {{ $__t('Transfer') }}
</a> </a>
@endif @endif
<a class="dropdown-item show-as-dialog-link" type="button" href="{{ $U('/inventory?embedded&product=' . $stockEntry->product_id ) }}"> <a class="dropdown-item show-as-dialog-link"
type="button"
href="{{ $U('/inventory?embedded&product=' . $stockEntry->product_id ) }}">
<i class="fas fa-list"></i> {{ $__t('Inventory') }} <i class="fas fa-list"></i> {{ $__t('Inventory') }}
</a> </a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item product-name-cell" data-product-id="{{ $stockEntry->product_id }}" type="button" href="#"> <a class="dropdown-item product-name-cell"
data-product-id="{{ $stockEntry->product_id }}"
type="button"
href="#">
<i class="fas fa-info"></i> {{ $__t('Show product details') }} <i class="fas fa-info"></i> {{ $__t('Show product details') }}
</a> </a>
<a class="dropdown-item" type="button" href="{{ $U('/stockjournal?product=') }}{{ $stockEntry->product_id }}"> <a class="dropdown-item"
type="button"
href="{{ $U('/stockjournal?product=') }}{{ $stockEntry->product_id }}">
<i class="fas fa-file-alt"></i> {{ $__t('Stock journal for this product') }} <i class="fas fa-file-alt"></i> {{ $__t('Stock journal for this product') }}
</a> </a>
<a class="dropdown-item" type="button" href="{{ $U('/product/') }}{{ $stockEntry->product_id . '?returnto=/stockentries' }}"> <a class="dropdown-item"
type="button"
href="{{ $U('/product/') }}{{ $stockEntry->product_id . '?returnto=/stockentries' }}">
<i class="fas fa-edit"></i> {{ $__t('Edit product') }} <i class="fas fa-edit"></i> {{ $__t('Edit product') }}
</a> </a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item stock-consume-button stock-consume-button-spoiled @if($stockEntry->amount < 1) disabled @endif" type="button" href="#" <a class="dropdown-item stock-consume-button stock-consume-button-spoiled @if($stockEntry->amount < 1) disabled @endif"
type="button"
href="#"
data-product-id="{{ $stockEntry->product_id }}" data-product-id="{{ $stockEntry->product_id }}"
data-product-name="{{ FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name }}" data-product-name="{{ FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name }}"
data-product-qu-name="{{ FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name }}" data-product-qu-name="{{ FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name }}"
@@ -121,41 +161,53 @@
<i class="fas fa-utensils"></i> {{ $__t('Consume %1$s of %2$s as spoiled', '1 ' . FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name) }} <i class="fas fa-utensils"></i> {{ $__t('Consume %1$s of %2$s as spoiled', '1 ' . FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name) }}
</a> </a>
@if(GROCY_FEATURE_FLAG_RECIPES) @if(GROCY_FEATURE_FLAG_RECIPES)
<a class="dropdown-item" type="button" href="{{ $U('/recipes?search=') }}{{ FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name }}"> <a class="dropdown-item"
type="button"
href="{{ $U('/recipes?search=') }}{{ FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name }}">
<i class="fas fa-cocktail"></i> {{ $__t('Search for recipes containing this product') }} <i class="fas fa-cocktail"></i> {{ $__t('Search for recipes containing this product') }}
</a> </a>
@endif @endif
</div> </div>
</div> </div>
</td> </td>
<td class="d-none" data-product-id="{{ $stockEntry->product_id }}"> <td class="d-none"
data-product-id="{{ $stockEntry->product_id }}">
{{ $stockEntry->product_id }} {{ $stockEntry->product_id }}
</td> </td>
<td class="product-name-cell cursor-link" data-product-id="{{ $stockEntry->product_id }}"> <td class="product-name-cell cursor-link"
data-product-id="{{ $stockEntry->product_id }}">
{{ FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name }} {{ FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name }}
</td> </td>
<td> <td>
<span id="stock-{{ $stockEntry->id }}-amount" class="locale-number locale-number-quantity-amount">{{ $stockEntry->amount }}</span> <span id="product-{{ $stockEntry->product_id }}-qu-name">{{ $__n($stockEntry->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name_plural) }}</span> <span id="stock-{{ $stockEntry->id }}-amount"
<span id="stock-{{ $stockEntry->id }}-opened-amount" class="small font-italic">@if($stockEntry->open == 1){{ $__t('Opened') }}@endif</span> class="locale-number locale-number-quantity-amount">{{ $stockEntry->amount }}</span> <span id="product-{{ $stockEntry->product_id }}-qu-name">{{ $__n($stockEntry->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name_plural) }}</span>
<span id="stock-{{ $stockEntry->id }}-opened-amount"
class="small font-italic">@if($stockEntry->open == 1){{ $__t('Opened') }}@endif</span>
</td> </td>
@if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) @if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
<td> <td>
<span id="stock-{{ $stockEntry->id }}-best-before-date">{{ $stockEntry->best_before_date }}</span> <span id="stock-{{ $stockEntry->id }}-best-before-date">{{ $stockEntry->best_before_date }}</span>
<time id="stock-{{ $stockEntry->id }}-best-before-date-timeago" class="timeago timeago-contextual" datetime="{{ $stockEntry->best_before_date }} 23:59:59"></time> <time id="stock-{{ $stockEntry->id }}-best-before-date-timeago"
class="timeago timeago-contextual"
datetime="{{ $stockEntry->best_before_date }} 23:59:59"></time>
</td> </td>
@endif @endif
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
<td id="stock-{{ $stockEntry->id }}-location" data-location-id="{{ $stockEntry->location_id }}"> <td id="stock-{{ $stockEntry->id }}-location"
data-location-id="{{ $stockEntry->location_id }}">
{{ FindObjectInArrayByPropertyValue($locations, 'id', $stockEntry->location_id)->name }} {{ FindObjectInArrayByPropertyValue($locations, 'id', $stockEntry->location_id)->name }}
</td> </td>
@endif @endif
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
<td id="stock-{{ $stockEntry->id }}-shopping-location" data-shopping-location-id="{{ $stockEntry->shopping_location_id }}"> <td id="stock-{{ $stockEntry->id }}-shopping-location"
data-shopping-location-id="{{ $stockEntry->shopping_location_id }}">
@if (FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $stockEntry->shopping_location_id) !== null) @if (FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $stockEntry->shopping_location_id) !== null)
{{ FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $stockEntry->shopping_location_id)->name }} {{ FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $stockEntry->shopping_location_id)->name }}
@endif @endif
</td> </td>
<td id="stock-{{ $stockEntry->id }}-price" class="locale-number locale-number-currency" data-price-id="{{ $stockEntry->price }}"> <td id="stock-{{ $stockEntry->id }}-price"
class="locale-number locale-number-currency"
data-price-id="{{ $stockEntry->price }}">
{{ $stockEntry->price }} {{ $stockEntry->price }}
</td> </td>
@endif @endif
@@ -164,12 +216,14 @@
</td> </td>
<td> <td>
<span id="stock-{{ $stockEntry->id }}-purchased-date">{{ $stockEntry->purchased_date }}</span> <span id="stock-{{ $stockEntry->id }}-purchased-date">{{ $stockEntry->purchased_date }}</span>
<time id="stock-{{ $stockEntry->id }}-purchased-date-timeago" class="timeago timeago-contextual" datetime="{{ $stockEntry->purchased_date }} 23:59:59"></time> <time id="stock-{{ $stockEntry->id }}-purchased-date-timeago"
class="timeago timeago-contextual"
datetime="{{ $stockEntry->purchased_date }} 23:59:59"></time>
</td> </td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $stockEntry->product_id) 'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $stockEntry->product_id)
)) ))
</tr> </tr>
@@ -179,14 +233,18 @@
</div> </div>
</div> </div>
<div class="modal fade" id="productcard-modal" tabindex="-1"> <div class="modal fade"
id="productcard-modal"
tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content text-center"> <div class="modal-content text-center">
<div class="modal-body"> <div class="modal-body">
@include('components.productcard') @include('components.productcard')
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ $__t('Close') }}</button> <button type="button"
class="btn btn-secondary"
data-dismiss="modal">{{ $__t('Close') }}</button>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -18,108 +18,117 @@
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-6 col-xl-4 pb-3"> <div class="col-xs-12 col-md-6 col-xl-4 pb-3">
<form id="stockentry-form" novalidate> <form id="stockentry-form"
novalidate>
@php @php
$product = FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id); $product = FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id);
@endphp @endphp
@php @php
$additionalGroupCssClasses = ''; $additionalGroupCssClasses = '';
if (!GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) if (!GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
{ {
$additionalGroupCssClasses = 'd-none'; $additionalGroupCssClasses = 'd-none';
} }
@endphp @endphp
@include('components.datetimepicker', array( @include('components.datetimepicker', array(
'id' => 'best_before_date', 'id' => 'best_before_date',
'initialValue' => $stockEntry->best_before_date, 'initialValue' => $stockEntry->best_before_date,
'label' => 'Best before', 'label' => 'Best before',
'format' => 'YYYY-MM-DD', 'format' => 'YYYY-MM-DD',
'initWithNow' => false, 'initWithNow' => false,
'limitEndToNow' => false, 'limitEndToNow' => false,
'limitStartToNow' => false, 'limitStartToNow' => false,
'invalidFeedback' => $__t('A best before date is required'), 'invalidFeedback' => $__t('A best before date is required'),
'nextInputSelector' => '#best_before_date', 'nextInputSelector' => '#best_before_date',
'additionalGroupCssClasses' => 'date-only-datetimepicker', 'additionalGroupCssClasses' => 'date-only-datetimepicker',
'shortcutValue' => '2999-12-31', 'shortcutValue' => '2999-12-31',
'shortcutLabel' => 'Never expires', 'shortcutLabel' => 'Never expires',
'earlierThanInfoLimit' => date('Y-m-d'), 'earlierThanInfoLimit' => date('Y-m-d'),
'earlierThanInfoText' => $__t('The given date is earlier than today, are you sure?'), 'earlierThanInfoText' => $__t('The given date is earlier than today, are you sure?'),
'additionalGroupCssClasses' => $additionalGroupCssClasses, 'additionalGroupCssClasses' => $additionalGroupCssClasses,
'activateNumberPad' => GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD 'activateNumberPad' => GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD
)) ))
@php $additionalGroupCssClasses = ''; @endphp @php $additionalGroupCssClasses = ''; @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'amount', 'id' => 'amount',
'value' => $stockEntry->amount, 'value' => $stockEntry->amount,
'label' => 'Amount', 'label' => 'Amount',
'hintId' => 'amount_qu_unit', 'hintId' => 'amount_qu_unit',
'invalidFeedback' => $__t('The amount cannot be lower than %s', '0'), 'invalidFeedback' => $__t('The amount cannot be lower than %s', '0'),
'additionalAttributes' => 'data-not-equal="-1"', 'additionalAttributes' => 'data-not-equal="-1"',
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info" class="text-small 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>' 'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info"
class="text-small 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>'
)) ))
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'qu_factor_purchase_to_stock', 'id' => 'qu_factor_purchase_to_stock',
'label' => 'Factor purchase to stock quantity unit', 'label' => 'Factor purchase to stock quantity unit',
'value' => $stockEntry->qu_factor_purchase_to_stock, 'value' => $stockEntry->qu_factor_purchase_to_stock,
'min' => 1, 'min' => 1,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'), 'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
'additionalCssClasses' => 'input-group-qu', 'additionalCssClasses' => 'input-group-qu',
'additionalHtmlElements' => '<p id="qu-conversion-info" class="form-text text-muted small d-none"></p>' 'additionalHtmlElements' => '<p id="qu-conversion-info"
class="form-text text-muted small d-none"></p>'
)) ))
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
@php @php
if (empty($stockEntry->price)) if (empty($stockEntry->price))
{ {
$price = ''; $price = '';
} }
else else
{ {
$price = $stockEntry->price; $price = $stockEntry->price;
} }
@endphp @endphp
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'price', 'id' => 'price',
'value' => $price, 'value' => $price,
'label' => 'Price', 'label' => 'Price',
'min' => 0, 'min' => 0,
'step' => 0.01, 'step' => 0.01,
'hint' => $__t('in %s per purchase quantity unit', GROCY_CURRENCY), 'hint' => $__t('in %s per purchase quantity unit', GROCY_CURRENCY),
'invalidFeedback' => $__t('The price cannot be lower than %s', '0'), 'invalidFeedback' => $__t('The price cannot be lower than %s', '0'),
'isRequired' => false 'isRequired' => false
)) ))
@include('components.shoppinglocationpicker', array( @include('components.shoppinglocationpicker', array(
'label' => 'Store', 'label' => 'Store',
'shoppinglocations' => $shoppinglocations, 'shoppinglocations' => $shoppinglocations,
'prefillById' => $stockEntry->shopping_location_id 'prefillById' => $stockEntry->shopping_location_id
)) ))
@else @else
<input type="hidden" name="price" id="price" value="0"> <input type="hidden"
name="price"
id="price"
value="0">
@endif @endif
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
@include('components.locationpicker', array( @include('components.locationpicker', array(
'locations' => $locations, 'locations' => $locations,
'prefillById' => $stockEntry->location_id 'prefillById' => $stockEntry->location_id
)) ))
@else @else
<input type="hidden" name="location_id" id="location_id" value="1"> <input type="hidden"
name="location_id"
id="location_id"
value="1">
@endif @endif
@include('components.datetimepicker2', array( @include('components.datetimepicker2', array(
'id' => 'purchase_date', 'id' => 'purchase_date',
'initialValue' => $stockEntry->purchased_date, 'initialValue' => $stockEntry->purchased_date,
'label' => 'Purchased date', 'label' => 'Purchased date',
'format' => 'YYYY-MM-DD', 'format' => 'YYYY-MM-DD',
'initWithNow' => false, 'initWithNow' => false,
'limitEndToNow' => false, 'limitEndToNow' => false,
'limitStartToNow' => false, 'limitStartToNow' => false,
'invalidFeedback' => $__t('A purchased date is required'), 'invalidFeedback' => $__t('A purchased date is required'),
'nextInputSelector' => '#save-stockentry-button', 'nextInputSelector' => '#save-stockentry-button',
'additionalGroupCssClasses' => 'date-only-datetimepicker' 'additionalGroupCssClasses' => 'date-only-datetimepicker'
)) ))
<div class="checkbox"> <div class="checkbox">
@@ -128,7 +137,8 @@
</label> </label>
</div> </div>
<button id="save-stockentry-button" class="btn btn-success">{{ $__t('OK') }}</button> <button id="save-stockentry-button"
class="btn btn-success">{{ $__t('OK') }}</button>
</form> </form>
</div> </div>

View File

@@ -16,20 +16,24 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-filter"></i></span> <span class="input-group-text"><i class="fas fa-filter"></i></span>
</div> </div>
<select class="form-control" id="product-filter"> <select class="form-control"
id="product-filter">
<option value="all">{{ $__t('All') }}</option> <option value="all">{{ $__t('All') }}</option>
@foreach($products as $product) @foreach($products as $product)
<option value="{{ $product->id }}">{{ $product->name }}</option> <option value="{{ $product->id }}">{{ $product->name }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
@@ -38,7 +42,8 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="stock-journal-table" class="table table-sm table-striped dt-responsive"> <table id="stock-journal-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -51,9 +56,16 @@
</thead> </thead>
<tbody class="d-none"> <tbody class="d-none">
@foreach($stockLog as $stockLogEntry) @foreach($stockLog as $stockLogEntry)
<tr id="stock-booking-{{ $stockLogEntry->id }}-row" class="@if($stockLogEntry->undone == 1) text-muted @endif stock-booking-correlation-{{ $stockLogEntry->correlation_id }}" data-correlation-id="{{ $stockLogEntry->correlation_id }}"> <tr id="stock-booking-{{ $stockLogEntry->id }}-row"
class="@if($stockLogEntry->undone == 1) text-muted @endif stock-booking-correlation-{{ $stockLogEntry->correlation_id }}"
data-correlation-id="{{ $stockLogEntry->correlation_id }}">
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-secondary btn-sm undo-stock-booking-button @if($stockLogEntry->undone == 1) disabled @endif" href="#" data-booking-id="{{ $stockLogEntry->id }}" data-toggle="tooltip" data-placement="left" title="{{ $__t('Undo booking') }}"> <a class="btn btn-secondary btn-sm undo-stock-booking-button @if($stockLogEntry->undone == 1) disabled @endif"
href="#"
data-booking-id="{{ $stockLogEntry->id }}"
data-toggle="tooltip"
data-placement="left"
title="{{ $__t('Undo booking') }}">
<i class="fas fa-undo"></i> <i class="fas fa-undo"></i>
</a> </a>
</td> </td>
@@ -62,7 +74,8 @@
@if($stockLogEntry->undone == 1) @if($stockLogEntry->undone == 1)
<br> <br>
{{ $__t('Undone on') . ' ' . $stockLogEntry->undone_timestamp }} {{ $__t('Undone on') . ' ' . $stockLogEntry->undone_timestamp }}
<time class="timeago timeago-contextual" datetime="{{ $stockLogEntry->undone_timestamp }}"></time> <time class="timeago timeago-contextual"
datetime="{{ $stockLogEntry->undone_timestamp }}"></time>
@endif @endif
</td> </td>
<td> <td>
@@ -70,7 +83,8 @@
</td> </td>
<td> <td>
{{ $stockLogEntry->row_created_timestamp }} {{ $stockLogEntry->row_created_timestamp }}
<time class="timeago timeago-contextual" datetime="{{ $stockLogEntry->row_created_timestamp }}"></time> <time class="timeago timeago-contextual"
datetime="{{ $stockLogEntry->row_created_timestamp }}"></time>
</td> </td>
<td> <td>
{{ $__t($stockLogEntry->transaction_type) }} {{ $__t($stockLogEntry->transaction_type) }}

View File

@@ -5,11 +5,12 @@
@section('viewJsName', 'stockoverview') @section('viewJsName', 'stockoverview')
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
@endpush @endpush
@push('pageScripts') @push('pageScripts')
<script src="{{ $U('/viewjs/purchase.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/viewjs/purchase.js?v=', true) }}{{ $version }}"></script>
@endpush @endpush
@section('content') @section('content')
@@ -18,27 +19,40 @@
<div class="title-related-links"> <div class="title-related-links">
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<div class="related-links"> <div class="related-links">
<a class="btn btn-outline-dark responsive-button" href="{{ $U('/stockjournal') }}"> <a class="btn btn-outline-dark responsive-button"
href="{{ $U('/stockjournal') }}">
{{ $__t('Journal') }} {{ $__t('Journal') }}
</a> </a>
<a class="btn btn-outline-dark responsive-button" href="{{ $U('/stockentries') }}"> <a class="btn btn-outline-dark responsive-button"
href="{{ $U('/stockentries') }}">
{{ $__t('Stock entries') }} {{ $__t('Stock entries') }}
</a> </a>
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
<a class="btn btn-outline-dark responsive-button" href="{{ $U('/locationcontentsheet') }}"> <a class="btn btn-outline-dark responsive-button"
href="{{ $U('/locationcontentsheet') }}">
{{ $__t('Location Content Sheet') }} {{ $__t('Location Content Sheet') }}
</a> </a>
@endif @endif
</div> </div>
</div> </div>
<div id="info-current-stock" class="text-muted"></div> <div id="info-current-stock"
class="text-muted"></div>
<hr> <hr>
@if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) @if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
<p id="info-expiring-products" data-next-x-days="{{ $nextXDays }}" data-status-filter="expiring" class="warning-message status-filter-message responsive-button mr-2"></p> <p id="info-expiring-products"
<p id="info-expired-products" data-status-filter="expired" class="error-message status-filter-message responsive-button mr-2"></p> data-next-x-days="{{ $nextXDays }}"
data-status-filter="expiring"
class="warning-message status-filter-message responsive-button mr-2"></p>
<p id="info-expired-products"
data-status-filter="expired"
class="error-message status-filter-message responsive-button mr-2"></p>
@endif @endif
<p id="info-missing-products" data-status-filter="belowminstockamount" class="normal-message status-filter-message responsive-button"></p> <p id="info-missing-products"
<a id="clear-filter-button" class="btn btn-sm btn-outline-info float-right" href="#"> data-status-filter="belowminstockamount"
class="normal-message status-filter-message responsive-button"></p>
<a id="clear-filter-button"
class="btn btn-sm btn-outline-info float-right"
href="#">
{{ $__t('Clear filter') }} {{ $__t('Clear filter') }}
</a> </a>
</div> </div>
@@ -49,7 +63,10 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
@@ -58,10 +75,11 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-filter"></i>&nbsp;{{ $__t('Location') }}</span> <span class="input-group-text"><i class="fas fa-filter"></i>&nbsp;{{ $__t('Location') }}</span>
</div> </div>
<select class="form-control" id="location-filter"> <select class="form-control"
id="location-filter">
<option value="all">{{ $__t('All') }}</option> <option value="all">{{ $__t('All') }}</option>
@foreach($locations as $location) @foreach($locations as $location)
<option value="{{ $location->name }}">{{ $location->name }}</option> <option value="{{ $location->name }}">{{ $location->name }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
@@ -72,10 +90,11 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-filter"></i>&nbsp;{{ $__t('Product group') }}</span> <span class="input-group-text"><i class="fas fa-filter"></i>&nbsp;{{ $__t('Product group') }}</span>
</div> </div>
<select class="form-control" id="product-group-filter"> <select class="form-control"
id="product-group-filter">
<option value="all">{{ $__t('All') }}</option> <option value="all">{{ $__t('All') }}</option>
@foreach($productGroups as $productGroup) @foreach($productGroups as $productGroup)
<option value="{{ $productGroup->name }}">{{ $productGroup->name }}</option> <option value="{{ $productGroup->name }}">{{ $productGroup->name }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
@@ -85,8 +104,10 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-filter"></i>&nbsp;{{ $__t('Status') }}</span> <span class="input-group-text"><i class="fas fa-filter"></i>&nbsp;{{ $__t('Status') }}</span>
</div> </div>
<select class="form-control" id="status-filter"> <select class="form-control"
<option class="bg-white" value="all">{{ $__t('All') }}</option> id="status-filter">
<option class="bg-white"
value="all">{{ $__t('All') }}</option>
@if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) @if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
<option value="expiring">{{ $__t('Expiring soon') }}</option> <option value="expiring">{{ $__t('Expiring soon') }}</option>
<option value="expired">{{ $__t('Already expired') }}</option> <option value="expired">{{ $__t('Already expired') }}</option>
@@ -99,7 +120,8 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="stock-overview-table" class="table table-sm table-striped dt-responsive"> <table id="stock-overview-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -112,23 +134,37 @@
<th class="d-none">Hidden product group</th> <th class="d-none">Hidden product group</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
</thead> </thead>
<tbody class="d-none"> <tbody class="d-none">
@foreach($currentStock as $currentStockEntry) @foreach($currentStock as $currentStockEntry)
<tr id="product-{{ $currentStockEntry->product_id }}-row" class="@if(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING && $currentStockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime('-1 days')) && $currentStockEntry->amount > 0) table-danger @elseif(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING && $currentStockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime("+$nextXDays days")) && $currentStockEntry->amount > 0) table-warning @elseif ($currentStockEntry->product_missing) table-info @endif"> <tr id="product-{{ $currentStockEntry->product_id }}-row"
class="@if(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING && $currentStockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime('-1 days')) && $currentStockEntry->amount > 0) table-danger @elseif(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING && $currentStockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime("
+$nextXDays
days"))
&&
$currentStockEntry->amount > 0) table-warning @elseif ($currentStockEntry->product_missing) table-info @endif">
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="permission-STOCK_CONSUME btn btn-success btn-sm product-consume-button @if($currentStockEntry->amount < 1 || $currentStockEntry->enable_tare_weight_handling == 1) disabled @endif" href="#" data-toggle="tooltip" data-placement="left" title="{{ $__t('Consume %1$s of %2$s', '1 ' . $currentStockEntry->qu_unit_name, $currentStockEntry->product_name) }}" <a class="permission-STOCK_CONSUME btn btn-success btn-sm product-consume-button @if($currentStockEntry->amount < 1 || $currentStockEntry->enable_tare_weight_handling == 1) disabled @endif"
href="#"
data-toggle="tooltip"
data-placement="left"
title="{{ $__t('Consume %1$s of %2$s', '1 ' . $currentStockEntry->qu_unit_name, $currentStockEntry->product_name) }}"
data-product-id="{{ $currentStockEntry->product_id }}" data-product-id="{{ $currentStockEntry->product_id }}"
data-product-name="{{ $currentStockEntry->product_name }}" data-product-name="{{ $currentStockEntry->product_name }}"
data-product-qu-name="{{ $currentStockEntry->qu_unit_name }}" data-product-qu-name="{{ $currentStockEntry->qu_unit_name }}"
data-consume-amount="1"> data-consume-amount="1">
<i class="fas fa-utensils"></i> 1 <i class="fas fa-utensils"></i> 1
</a> </a>
<a id="product-{{ $currentStockEntry->product_id }}-consume-all-button" class="permission-STOCK_CONSUME d-none d-sm-inline-block 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', $currentStockEntry->product_name) }}" <a id="product-{{ $currentStockEntry->product_id }}-consume-all-button"
class="permission-STOCK_CONSUME d-none d-sm-inline-block 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', $currentStockEntry->product_name) }}"
data-product-id="{{ $currentStockEntry->product_id }}" data-product-id="{{ $currentStockEntry->product_id }}"
data-product-name="{{ $currentStockEntry->product_name }}" data-product-name="{{ $currentStockEntry->product_name }}"
data-product-qu-name="{{ $currentStockEntry->qu_unit_name }}" data-product-qu-name="{{ $currentStockEntry->qu_unit_name }}"
@@ -137,7 +173,11 @@
<i class="fas fa-utensils"></i> {{ $__t('All') }} <i class="fas fa-utensils"></i> {{ $__t('All') }}
</a> </a>
@if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING)
<a class="btn btn-success btn-sm product-open-button @if($currentStockEntry->amount < 1 || $currentStockEntry->amount == $currentStockEntry->amount_opened || $currentStockEntry->enable_tare_weight_handling == 1) disabled @endif" href="#" data-toggle="tooltip" data-placement="left" title="{{ $__t('Mark %1$s of %2$s as open', '1 ' . $currentStockEntry->qu_unit_name, $currentStockEntry->product_name) }}" <a class="btn btn-success btn-sm product-open-button @if($currentStockEntry->amount < 1 || $currentStockEntry->amount == $currentStockEntry->amount_opened || $currentStockEntry->enable_tare_weight_handling == 1) disabled @endif"
href="#"
data-toggle="tooltip"
data-placement="left"
title="{{ $__t('Mark %1$s of %2$s as open', '1 ' . $currentStockEntry->qu_unit_name, $currentStockEntry->product_name) }}"
data-product-id="{{ $currentStockEntry->product_id }}" data-product-id="{{ $currentStockEntry->product_id }}"
data-product-name="{{ $currentStockEntry->product_name }}" data-product-name="{{ $currentStockEntry->product_name }}"
data-product-qu-name="{{ $currentStockEntry->qu_unit_name }}"> data-product-qu-name="{{ $currentStockEntry->qu_unit_name }}">
@@ -145,51 +185,78 @@
</a> </a>
@endif @endif
<div class="dropdown d-inline-block"> <div class="dropdown d-inline-block">
<button class="btn btn-sm btn-light text-secondary" type="button" data-toggle="dropdown"> <button class="btn btn-sm btn-light text-secondary"
type="button"
data-toggle="dropdown">
<i class="fas fa-ellipsis-v"></i> <i class="fas fa-ellipsis-v"></i>
</button> </button>
<div class="table-inline-menu dropdown-menu dropdown-menu-right"> <div class="table-inline-menu dropdown-menu dropdown-menu-right">
<a id="product-{{ $currentStockEntry->product_id }}-consume-all-button" class="d-inline-block d-sm-none dropdown-item show-as-dialog-link text-danger product-consume-button @if($currentStockEntry->amount == 0) disabled @endif" href="#" data-toggle="tooltip" data-placement="right" <a id="product-{{ $currentStockEntry->product_id }}-consume-all-button"
class="d-inline-block d-sm-none dropdown-item show-as-dialog-link text-danger product-consume-button @if($currentStockEntry->amount == 0) disabled @endif"
href="#"
data-toggle="tooltip"
data-placement="right"
data-product-id="{{ $currentStockEntry->product_id }}" data-product-id="{{ $currentStockEntry->product_id }}"
data-product-name="{{ $currentStockEntry->product_name }}" data-product-name="{{ $currentStockEntry->product_name }}"
data-product-qu-name="{{ $currentStockEntry->qu_unit_name }}" data-product-qu-name="{{ $currentStockEntry->qu_unit_name }}"
data-consume-amount="{{ $currentStockEntry->amount }}"> data-consume-amount="{{ $currentStockEntry->amount }}">
<span class="dropdown-item-icon"><i class="fas fa-utensils"></i></span> <span class="dropdown-item-text">{{ $__t('Consume all %s which are currently in stock', $currentStockEntry->product_name) }}</span> <span class="dropdown-item-icon"><i class="fas fa-utensils"></i></span> <span class="dropdown-item-text">{{ $__t('Consume all %s which are currently in stock', $currentStockEntry->product_name) }}</span>
</a> </a>
<a class="dropdown-item show-as-dialog-link permission-SHOPPINGLIST_ITEMS_ADD" type="button" href="{{ $U('/shoppinglistitem/new?embedded&updateexistingproduct&product=' . $currentStockEntry->product_id ) }}"> <a class="dropdown-item show-as-dialog-link permission-SHOPPINGLIST_ITEMS_ADD"
type="button"
href="{{ $U('/shoppinglistitem/new?embedded&updateexistingproduct&product=' . $currentStockEntry->product_id ) }}">
<span class="dropdown-item-icon"><i class="fas fa-shopping-cart"></i></span> <span class="dropdown-item-text">{{ $__t('Add to shopping list') }}</span> <span class="dropdown-item-icon"><i class="fas fa-shopping-cart"></i></span> <span class="dropdown-item-text">{{ $__t('Add to shopping list') }}</span>
</a> </a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item show-as-dialog-link permission-STOCK_PURCHASE" type="button" href="{{ $U('/purchase?embedded&product=' . $currentStockEntry->product_id ) }}"> <a class="dropdown-item show-as-dialog-link permission-STOCK_PURCHASE"
type="button"
href="{{ $U('/purchase?embedded&product=' . $currentStockEntry->product_id ) }}">
<span class="dropdown-item-icon"><i class="fas fa-shopping-cart"></i></span> <span class="dropdown-item-text">{{ $__t('Purchase') }}</span> <span class="dropdown-item-icon"><i class="fas fa-shopping-cart"></i></span> <span class="dropdown-item-text">{{ $__t('Purchase') }}</span>
</a> </a>
<a class="dropdown-item show-as-dialog-link permission-STOCK_CONSUME" type="button" href="{{ $U('/consume?embedded&product=' . $currentStockEntry->product_id ) }}"> <a class="dropdown-item show-as-dialog-link permission-STOCK_CONSUME"
type="button"
href="{{ $U('/consume?embedded&product=' . $currentStockEntry->product_id ) }}">
<span class="dropdown-item-icon"><i class="fas fa-utensils"></i></span> <span class="dropdown-item-text">{{ $__t('Consume') }}</span> <span class="dropdown-item-icon"><i class="fas fa-utensils"></i></span> <span class="dropdown-item-text">{{ $__t('Consume') }}</span>
</a> </a>
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
<a class="dropdown-item show-as-dialog-link permission-STOCK_TRANSFER @if($currentStockEntry->amount < 1) disabled @endif" type="button" href="{{ $U('/transfer?embedded&product=' . $currentStockEntry->product_id) }}"> <a class="dropdown-item show-as-dialog-link permission-STOCK_TRANSFER @if($currentStockEntry->amount < 1) disabled @endif"
type="button"
href="{{ $U('/transfer?embedded&product=' . $currentStockEntry->product_id) }}">
<span class="dropdown-item-icon"><i class="fas fa-exchange-alt"></i></span> <span class="dropdown-item-text">{{ $__t('Transfer') }}</span> <span class="dropdown-item-icon"><i class="fas fa-exchange-alt"></i></span> <span class="dropdown-item-text">{{ $__t('Transfer') }}</span>
</a> </a>
@endif @endif
<a class="dropdown-item show-as-dialog-link permission-STOCK_INVENTORY" type="button" href="{{ $U('/inventory?embedded&product=' . $currentStockEntry->product_id ) }}"> <a class="dropdown-item show-as-dialog-link permission-STOCK_INVENTORY"
type="button"
href="{{ $U('/inventory?embedded&product=' . $currentStockEntry->product_id ) }}">
<span class="dropdown-item-icon"><i class="fas fa-list"></i></span> <span class="dropdown-item-text">{{ $__t('Inventory') }}</span> <span class="dropdown-item-icon"><i class="fas fa-list"></i></span> <span class="dropdown-item-text">{{ $__t('Inventory') }}</span>
</a> </a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item product-name-cell" data-product-id="{{ $currentStockEntry->product_id }}" type="button" href="#"> <a class="dropdown-item product-name-cell"
data-product-id="{{ $currentStockEntry->product_id }}"
type="button"
href="#">
<span class="dropdown-item-icon"><i class="fas fa-info"></i></span> <span class="dropdown-item-text">{{ $__t('Show product details') }}</span> <span class="dropdown-item-icon"><i class="fas fa-info"></i></span> <span class="dropdown-item-text">{{ $__t('Show product details') }}</span>
</a> </a>
<a class="dropdown-item" type="button" href="{{ $U('/stockentries?product=') }}{{ $currentStockEntry->product_id }}" <a class="dropdown-item"
type="button"
href="{{ $U('/stockentries?product=') }}{{ $currentStockEntry->product_id }}"
data-product-id="{{ $currentStockEntry->product_id }}"> data-product-id="{{ $currentStockEntry->product_id }}">
<span class="dropdown-item-icon"><i class="fas fa-boxes"></i></span> <span class="dropdown-item-text">{{ $__t('Show stock entries') }}</span> <span class="dropdown-item-icon"><i class="fas fa-boxes"></i></span> <span class="dropdown-item-text">{{ $__t('Show stock entries') }}</span>
</a> </a>
<a class="dropdown-item" type="button" href="{{ $U('/stockjournal?product=') }}{{ $currentStockEntry->product_id }}"> <a class="dropdown-item"
type="button"
href="{{ $U('/stockjournal?product=') }}{{ $currentStockEntry->product_id }}">
<span class="dropdown-item-icon"><i class="fas fa-file-alt"></i></span> <span class="dropdown-item-text">{{ $__t('Stock journal for this product') }}</span> <span class="dropdown-item-icon"><i class="fas fa-file-alt"></i></span> <span class="dropdown-item-text">{{ $__t('Stock journal for this product') }}</span>
</a> </a>
<a class="dropdown-item permission-MASTER_DATA_EDIT" type="button" href="{{ $U('/product/') }}{{ $currentStockEntry->product_id . '?returnto=%2Fstockoverview' }}"> <a class="dropdown-item permission-MASTER_DATA_EDIT"
type="button"
href="{{ $U('/product/') }}{{ $currentStockEntry->product_id . '?returnto=%2Fstockoverview' }}">
<span class="dropdown-item-icon"><i class="fas fa-edit"></i></span> <span class="dropdown-item-text">{{ $__t('Edit product') }}</span> <span class="dropdown-item-icon"><i class="fas fa-edit"></i></span> <span class="dropdown-item-text">{{ $__t('Edit product') }}</span>
</a> </a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item product-consume-button product-consume-button-spoiled permission-STOCK_CONSUME @if($currentStockEntry->amount < 1) disabled @endif" type="button" href="#" <a class="dropdown-item product-consume-button product-consume-button-spoiled permission-STOCK_CONSUME @if($currentStockEntry->amount < 1) disabled @endif"
type="button"
href="#"
data-product-id="{{ $currentStockEntry->product_id }}" data-product-id="{{ $currentStockEntry->product_id }}"
data-product-name="{{ $currentStockEntry->product_name }}" data-product-name="{{ $currentStockEntry->product_name }}"
data-product-qu-name="{{ $currentStockEntry->qu_unit_name }}" data-product-qu-name="{{ $currentStockEntry->qu_unit_name }}"
@@ -197,29 +264,37 @@
<span class="dropdown-item-icon"><i class="fas fa-utensils"></i></span> <span class="dropdown-item-text">{{ $__t('Consume %1$s of %2$s as spoiled', '1 ' . $currentStockEntry->qu_unit_name, $currentStockEntry->product_name) }}</span> <span class="dropdown-item-icon"><i class="fas fa-utensils"></i></span> <span class="dropdown-item-text">{{ $__t('Consume %1$s of %2$s as spoiled', '1 ' . $currentStockEntry->qu_unit_name, $currentStockEntry->product_name) }}</span>
</a> </a>
@if(GROCY_FEATURE_FLAG_RECIPES) @if(GROCY_FEATURE_FLAG_RECIPES)
<a class="dropdown-item" type="button" href="{{ $U('/recipes?search=') }}{{ $currentStockEntry->product_name }}"> <a class="dropdown-item"
type="button"
href="{{ $U('/recipes?search=') }}{{ $currentStockEntry->product_name }}">
<span class="dropdown-item-icon"><i class="fas fa-cocktail"></i></span> <span class="dropdown-item-text">{{ $__t('Search for recipes containing this product') }}</span> <span class="dropdown-item-icon"><i class="fas fa-cocktail"></i></span> <span class="dropdown-item-text">{{ $__t('Search for recipes containing this product') }}</span>
</a> </a>
@endif @endif
</div> </div>
</div> </div>
</td> </td>
<td class="product-name-cell cursor-link" data-product-id="{{ $currentStockEntry->product_id }}"> <td class="product-name-cell cursor-link"
data-product-id="{{ $currentStockEntry->product_id }}">
{{ $currentStockEntry->product_name }} {{ $currentStockEntry->product_name }}
</td> </td>
<td> <td>
@if($currentStockEntry->product_group_name !== null){{ $currentStockEntry->product_group_name }}@endif @if($currentStockEntry->product_group_name !== null){{ $currentStockEntry->product_group_name }}@endif
</td> </td>
<td> <td>
<span id="product-{{ $currentStockEntry->product_id }}-amount" class="locale-number locale-number-quantity-amount">{{ $currentStockEntry->amount }}</span> <span id="product-{{ $currentStockEntry->product_id }}-qu-name">{{ $__n($currentStockEntry->amount, $currentStockEntry->qu_unit_name, $currentStockEntry->qu_unit_name_plural) }}</span> <span id="product-{{ $currentStockEntry->product_id }}-amount"
<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> class="locale-number locale-number-quantity-amount">{{ $currentStockEntry->amount }}</span> <span id="product-{{ $currentStockEntry->product_id }}-qu-name">{{ $__n($currentStockEntry->amount, $currentStockEntry->qu_unit_name, $currentStockEntry->qu_unit_name_plural) }}</span>
<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>
@if($currentStockEntry->amount != $currentStockEntry->factor_purchase_amount) @if($currentStockEntry->amount != $currentStockEntry->factor_purchase_amount)
<span id="product-{{ $currentStockEntry->product_id }}-factor-purchase-amount" class="locale-number locale-number-quantity-amount">({{ $currentStockEntry->factor_purchase_amount }}</span> <span id="product-{{ $currentStockEntry->product_id }}-qu-purchase-name">{{ $__n($currentStockEntry->factor_purchase_amount, $currentStockEntry->qu_purchase_unit_name,$currentStockEntry->qu_purchase_unit_name_plural) }})</span> <span id="product-{{ $currentStockEntry->product_id }}-factor-purchase-amount"
class="locale-number locale-number-quantity-amount">({{ $currentStockEntry->factor_purchase_amount }}</span> <span id="product-{{ $currentStockEntry->product_id }}-qu-purchase-name">{{ $__n($currentStockEntry->factor_purchase_amount, $currentStockEntry->qu_purchase_unit_name,$currentStockEntry->qu_purchase_unit_name_plural) }})</span>
@endif @endif
@if($currentStockEntry->is_aggregated_amount == 1) @if($currentStockEntry->is_aggregated_amount == 1)
<span class="pl-1 text-secondary"> <span class="pl-1 text-secondary">
<i class="fas fa-custom-sigma-sign"></i> <span id="product-{{ $currentStockEntry->product_id }}-amount-aggregated" class="locale-number locale-number-quantity-amount">{{ $currentStockEntry->amount_aggregated }}</span> {{ $__n($currentStockEntry->amount_aggregated, $currentStockEntry->qu_unit_name, $currentStockEntry->qu_unit_name_plural) }} <i class="fas fa-custom-sigma-sign"></i> <span id="product-{{ $currentStockEntry->product_id }}-amount-aggregated"
@if($currentStockEntry->amount_opened_aggregated > 0)<span id="product-{{ $currentStockEntry->product_id }}-opened-amount-aggregated" class="small font-italic">{{ $__t('%s opened', $currentStockEntry->amount_opened_aggregated) }}</span>@endif class="locale-number locale-number-quantity-amount">{{ $currentStockEntry->amount_aggregated }}</span> {{ $__n($currentStockEntry->amount_aggregated, $currentStockEntry->qu_unit_name, $currentStockEntry->qu_unit_name_plural) }}
@if($currentStockEntry->amount_opened_aggregated > 0)<span id="product-{{ $currentStockEntry->product_id }}-opened-amount-aggregated"
class="small font-italic">{{ $__t('%s opened', $currentStockEntry->amount_opened_aggregated) }}</span>@endif
</span> </span>
@endif @endif
@if(boolval($userSettings['show_icon_on_stock_overview_page_when_product_is_on_shopping_list'])) @if(boolval($userSettings['show_icon_on_stock_overview_page_when_product_is_on_shopping_list']))
@@ -232,7 +307,9 @@
</td> </td>
<td class="@if(!GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) d-none @endif"> <td class="@if(!GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) d-none @endif">
<span id="product-{{ $currentStockEntry->product_id }}-next-best-before-date">{{ $currentStockEntry->best_before_date }}</span> <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 }} 23:59:59"></time> <time id="product-{{ $currentStockEntry->product_id }}-next-best-before-date-timeago"
class="timeago timeago-contextual"
datetime="{{ $currentStockEntry->best_before_date }} 23:59:59"></time>
</td> </td>
<td class="d-none"> <td class="d-none">
@foreach(FindAllObjectsInArrayByPropertyValue($currentStockLocations, 'product_id', $currentStockEntry->product_id) as $locationsForProduct) @foreach(FindAllObjectsInArrayByPropertyValue($currentStockLocations, 'product_id', $currentStockEntry->product_id) as $locationsForProduct)
@@ -240,15 +317,25 @@
@endforeach @endforeach
</td> </td>
<td class="d-none"> <td class="d-none">
@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($currentStockEntry->product_missing) belowminstockamount @endif @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($currentStockEntry->product_missing) belowminstockamount @endif
</td> </td>
<td class="d-none"> <td class="d-none">
xx{{ $currentStockEntry->product_group_name }}xx xx{{ $currentStockEntry->product_group_name }}xx
</td> </td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $currentStockEntry->product_id) 'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $currentStockEntry->product_id)
)) ))
</tr> </tr>
@@ -258,14 +345,18 @@
</div> </div>
</div> </div>
<div class="modal fade" id="stockoverview-productcard-modal" tabindex="-1"> <div class="modal fade"
id="stockoverview-productcard-modal"
tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content text-center"> <div class="modal-content text-center">
<div class="modal-body"> <div class="modal-body">
@include('components.productcard') @include('components.productcard')
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ $__t('Close') }}</button> <button type="button"
class="btn btn-secondary"
data-dismiss="modal">{{ $__t('Close') }}</button>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -19,10 +19,12 @@
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
<div class="form-group"> <div class="form-group">
<label for="product_presets_location_id">{{ $__t('Location') }}</label> <label for="product_presets_location_id">{{ $__t('Location') }}</label>
<select class="form-control user-setting-control" id="product_presets_location_id" data-setting-key="product_presets_location_id"> <select class="form-control user-setting-control"
id="product_presets_location_id"
data-setting-key="product_presets_location_id">
<option value="-1"></option> <option value="-1"></option>
@foreach($locations as $location) @foreach($locations as $location)
<option value="{{ $location->id }}">{{ $location->name }}</option> <option value="{{ $location->id }}">{{ $location->name }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
@@ -30,20 +32,24 @@
<div class="form-group"> <div class="form-group">
<label for="product_presets_product_group_id">{{ $__t('Product group') }}</label> <label for="product_presets_product_group_id">{{ $__t('Product group') }}</label>
<select class="form-control user-setting-control" id="product_presets_product_group_id" data-setting-key="product_presets_product_group_id"> <select class="form-control user-setting-control"
id="product_presets_product_group_id"
data-setting-key="product_presets_product_group_id">
<option value="-1"></option> <option value="-1"></option>
@foreach($productGroups as $productGroup) @foreach($productGroups as $productGroup)
<option value="{{ $productGroup->id }}">{{ $productGroup->name }}</option> <option value="{{ $productGroup->id }}">{{ $productGroup->name }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="product_presets_qu_id">{{ $__t('Quantity unit') }}</label> <label for="product_presets_qu_id">{{ $__t('Quantity unit') }}</label>
<select class="form-control user-setting-control" id="product_presets_qu_id" data-setting-key="product_presets_qu_id"> <select class="form-control user-setting-control"
id="product_presets_qu_id"
data-setting-key="product_presets_qu_id">
<option value="-1"></option> <option value="-1"></option>
@foreach($quantityunits as $quantityunit) @foreach($quantityunits as $quantityunit)
<option value="{{ $quantityunit->id }}">{{ $quantityunit->name }}</option> <option value="{{ $quantityunit->id }}">{{ $quantityunit->name }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
@@ -51,43 +57,47 @@
<h4 class="mt-2">{{ $__t('Stock overview') }}</h4> <h4 class="mt-2">{{ $__t('Stock overview') }}</h4>
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'stock_expring_soon_days', 'id' => 'stock_expring_soon_days',
'additionalAttributes' => 'data-setting-key="stock_expring_soon_days"', 'additionalAttributes' => 'data-setting-key="stock_expring_soon_days"',
'label' => 'Expiring soon days', 'label' => 'Expiring soon days',
'min' => 1, 'min' => 1,
'invalidFeedback' => $__t('This cannot be lower than %s', '1'), 'invalidFeedback' => $__t('This cannot be lower than %s', '1'),
'additionalCssClasses' => 'user-setting-control' 'additionalCssClasses' => 'user-setting-control'
)) ))
<h4 class="mt-2">{{ $__t('Purchase') }}</h4> <h4 class="mt-2">{{ $__t('Purchase') }}</h4>
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'stock_default_purchase_amount', 'id' => 'stock_default_purchase_amount',
'additionalAttributes' => 'data-setting-key="stock_default_purchase_amount"', 'additionalAttributes' => 'data-setting-key="stock_default_purchase_amount"',
'label' => 'Default amount for purchase', 'label' => 'Default amount for purchase',
'min' => 0, 'min' => 0,
'invalidFeedback' => $__t('This cannot be lower than %s', '1'), 'invalidFeedback' => $__t('This cannot be lower than %s', '1'),
'additionalCssClasses' => 'user-setting-control' 'additionalCssClasses' => 'user-setting-control'
)) ))
<h4 class="mt-2">{{ $__t('Consume') }}</h4> <h4 class="mt-2">{{ $__t('Consume') }}</h4>
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'stock_default_consume_amount', 'id' => 'stock_default_consume_amount',
'additionalAttributes' => 'data-setting-key="stock_default_consume_amount"', 'additionalAttributes' => 'data-setting-key="stock_default_consume_amount"',
'label' => 'Default amount for consume', 'label' => 'Default amount for consume',
'min' => 1, 'min' => 1,
'invalidFeedback' => $__t('This cannot be lower than %s', '1'), 'invalidFeedback' => $__t('This cannot be lower than %s', '1'),
'additionalCssClasses' => 'user-setting-control' 'additionalCssClasses' => 'user-setting-control'
)) ))
<div class="form-group"> <div class="form-group">
<div class="checkbox"> <div class="checkbox">
<label for="show_icon_on_stock_overview_page_when_product_is_on_shopping_list"> <label for="show_icon_on_stock_overview_page_when_product_is_on_shopping_list">
<input type="checkbox" class="user-setting-control" id="show_icon_on_stock_overview_page_when_product_is_on_shopping_list" data-setting-key="show_icon_on_stock_overview_page_when_product_is_on_shopping_list"> {{ $__t('Show an icon if the product is already on the shopping list') }} <input type="checkbox"
class="user-setting-control"
id="show_icon_on_stock_overview_page_when_product_is_on_shopping_list"
data-setting-key="show_icon_on_stock_overview_page_when_product_is_on_shopping_list"> {{ $__t('Show an icon if the product is already on the shopping list') }}
</label> </label>
</div> </div>
</div> </div>
<a href="{{ $U('/stockoverview') }}" class="btn btn-success">{{ $__t('OK') }}</a> <a href="{{ $U('/stockoverview') }}"
class="btn btn-success">{{ $__t('OK') }}</a>
</div> </div>
</div> </div>
@stop @stop

View File

@@ -10,7 +10,8 @@
<div class="title-related-links"> <div class="title-related-links">
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<div class="related-links"> <div class="related-links">
<a class="btn btn-outline-secondary" href="{{ $U('/userfields?entity=task_categories') }}"> <a class="btn btn-outline-secondary"
href="{{ $U('/userfields?entity=task_categories') }}">
{{ $__t('Configure userfields') }} {{ $__t('Configure userfields') }}
</a> </a>
</div> </div>
@@ -20,7 +21,8 @@
<hr> <hr>
<div class="row mt-3"> <div class="row mt-3">
<div class="col-xs-12 col-md-2 col-xl-1"> <div class="col-xs-12 col-md-2 col-xl-1">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3" href="{{ $U('/taskcategory/new') }}"> <a class="btn btn-primary btn-sm responsive-button w-100 mb-3"
href="{{ $U('/taskcategory/new') }}">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
@@ -29,16 +31,20 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="taskcategories-table" class="table table-sm table-striped dt-responsive"> <table id="taskcategories-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -46,7 +52,7 @@
<th>{{ $__t('Description') }}</th> <th>{{ $__t('Description') }}</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
@@ -55,10 +61,14 @@
@foreach($taskCategories as $taskCategory) @foreach($taskCategories as $taskCategory)
<tr> <tr>
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-info btn-sm" href="{{ $U('/taskcategory/') }}{{ $taskCategory->id }}"> <a class="btn btn-info btn-sm"
href="{{ $U('/taskcategory/') }}{{ $taskCategory->id }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-danger btn-sm task-category-delete-button" href="#" data-category-id="{{ $taskCategory->id }}" data-category-name="{{ $taskCategory->name }}"> <a class="btn btn-danger btn-sm task-category-delete-button"
href="#"
data-category-id="{{ $taskCategory->id }}"
data-category-name="{{ $taskCategory->name }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
</td> </td>
@@ -70,8 +80,8 @@
</td> </td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $taskCategory->id) 'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $taskCategory->id)
)) ))
</tr> </tr>

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit task category')) @section('title', $__t('Edit task category'))
@else @else
@section('title', $__t('Create task category')) @section('title', $__t('Create task category'))
@endif @endif
@section('viewJsName', 'taskcategoryform') @section('viewJsName', 'taskcategoryform')
@@ -17,31 +17,45 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<script>Grocy.EditMode = '{{ $mode }}';</script> <script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $category->id }};</script> <script>
Grocy.EditObjectId = {{ $category->id }};
</script>
@endif @endif
<form id="task-category-form" novalidate> <form id="task-category-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Name') }}</label> <label for="name">{{ $__t('Name') }}</label>
<input type="text" class="form-control" required id="name" name="name" value="@if($mode == 'edit'){{ $category->name }}@endif"> <input type="text"
class="form-control"
required
id="name"
name="name"
value="@if($mode == 'edit'){{ $category->name }}@endif">
<div class="invalid-feedback">{{ $__t('A name is required') }}</div> <div class="invalid-feedback">{{ $__t('A name is required') }}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="description">{{ $__t('Description') }}</label> <label for="description">{{ $__t('Description') }}</label>
<textarea class="form-control" rows="2" id="description" name="description">@if($mode == 'edit'){{ $category->description }}@endif</textarea> <textarea class="form-control"
rows="2"
id="description"
name="description">@if($mode == 'edit'){{ $category->description }}@endif</textarea>
</div> </div>
@include('components.userfieldsform', array( @include('components.userfieldsform', array(
'userfields' => $userfields, 'userfields' => $userfields,
'entity' => 'task_categories' 'entity' => 'task_categories'
)) ))
<button id="save-task-category-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-task-category-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit task')) @section('title', $__t('Edit task'))
@else @else
@section('title', $__t('Create task')) @section('title', $__t('Create task'))
@endif @endif
@section('viewJsName', 'taskform') @section('viewJsName', 'taskform')
@@ -17,52 +17,69 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<script>Grocy.EditMode = '{{ $mode }}';</script> <script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $task->id }};</script> <script>
Grocy.EditObjectId = {{ $task->id }};
</script>
@endif @endif
<form id="task-form" novalidate> <form id="task-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Name') }}</label> <label for="name">{{ $__t('Name') }}</label>
<input type="text" class="form-control" required id="name" name="name" value="@if($mode == 'edit'){{ $task->name }}@endif"> <input type="text"
class="form-control"
required
id="name"
name="name"
value="@if($mode == 'edit'){{ $task->name }}@endif">
<div class="invalid-feedback">{{ $__t('A name is required') }}</div> <div class="invalid-feedback">{{ $__t('A name is required') }}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="description">{{ $__t('Description') }}</label> <label for="description">{{ $__t('Description') }}</label>
<textarea class="form-control" rows="2" id="description" name="description">@if($mode == 'edit'){{ $task->description }}@endif</textarea> <textarea class="form-control"
rows="2"
id="description"
name="description">@if($mode == 'edit'){{ $task->description }}@endif</textarea>
</div> </div>
@php @php
$initialDueDate = null; $initialDueDate = null;
if ($mode == 'edit') if ($mode == 'edit')
{ {
$initialDueDate = date('Y-m-d', strtotime($task->due_date)); $initialDueDate = date('Y-m-d', strtotime($task->due_date));
} }
@endphp @endphp
@include('components.datetimepicker', array( @include('components.datetimepicker', array(
'id' => 'due_date', 'id' => 'due_date',
'label' => 'Due', 'label' => 'Due',
'format' => 'YYYY-MM-DD', 'format' => 'YYYY-MM-DD',
'initWithNow' => false, 'initWithNow' => false,
'initialValue' => $initialDueDate, 'initialValue' => $initialDueDate,
'limitEndToNow' => false, 'limitEndToNow' => false,
'limitStartToNow' => false, 'limitStartToNow' => false,
'invalidFeedback' => $__t('A due date is required'), 'invalidFeedback' => $__t('A due date is required'),
'nextInputSelector' => 'category_id', 'nextInputSelector' => 'category_id',
'additionalGroupCssClasses' => 'date-only-datetimepicker', 'additionalGroupCssClasses' => 'date-only-datetimepicker',
'isRequired' => false 'isRequired' => false
)) ))
<div class="form-group"> <div class="form-group">
<label for="category_id">{{ $__t('Category') }}</label> <label for="category_id">{{ $__t('Category') }}</label>
<select class="form-control" id="category_id" name="category_id"> <select class="form-control"
id="category_id"
name="category_id">
<option></option> <option></option>
@foreach($taskCategories as $taskCategory) @foreach($taskCategories as $taskCategory)
<option @if($mode == 'edit' && $taskCategory->id == $task->category_id) selected="selected" @endif value="{{ $taskCategory->id }}">{{ $taskCategory->name }}</option> <option @if($mode=='edit'
&&
$taskCategory->id == $task->category_id) selected="selected" @endif value="{{ $taskCategory->id }}">{{ $taskCategory->name }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
@@ -71,21 +88,22 @@
$initUserId = GROCY_USER_ID; $initUserId = GROCY_USER_ID;
if ($mode == 'edit') if ($mode == 'edit')
{ {
$initUserId = $task->assigned_to_user_id; $initUserId = $task->assigned_to_user_id;
} }
@endphp @endphp
@include('components.userpicker', array( @include('components.userpicker', array(
'label' => 'Assigned to', 'label' => 'Assigned to',
'users' => $users, 'users' => $users,
'prefillByUserId' => $initUserId 'prefillByUserId' => $initUserId
)) ))
@include('components.userfieldsform', array( @include('components.userfieldsform', array(
'userfields' => $userfields, 'userfields' => $userfields,
'entity' => 'tasks' 'entity' => 'tasks'
)) ))
<button id="save-task-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-task-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>

View File

@@ -5,13 +5,15 @@
@section('viewJsName', 'tasks') @section('viewJsName', 'tasks')
@push('pageScripts') @push('pageScripts')
<script src="{{ $U('/node_modules/datatables.net-rowgroup/js/dataTables.rowGroup.min.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/node_modules/datatables.net-rowgroup/js/dataTables.rowGroup.min.js?v=', true) }}{{ $version }}"></script>
<script src="{{ $U('/node_modules/datatables.net-rowgroup-bs4/js/rowGroup.bootstrap4.min.js?v=', true) }}{{ $version }}"></script> <script src="{{ $U('/node_modules/datatables.net-rowgroup-bs4/js/rowGroup.bootstrap4.min.js?v=', true) }}{{ $version }}"></script>
@endpush @endpush
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}"
<link href="{{ $U('/node_modules/datatables.net-rowgroup-bs4/css/rowGroup.bootstrap4.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> rel="stylesheet">
<link href="{{ $U('/node_modules/datatables.net-rowgroup-bs4/css/rowGroup.bootstrap4.min.css?v=', true) }}{{ $version }}"
rel="stylesheet">
@endpush @endpush
@section('content') @section('content')
@@ -19,14 +21,20 @@
<div class="col"> <div class="col">
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<hr> <hr>
<p id="info-due-tasks" data-status-filter="duesoon" data-next-x-days="{{ $nextXDays }}" class="warning-message status-filter-message responsive-button mr-2"></p> <p id="info-due-tasks"
<p id="info-overdue-tasks" data-status-filter="overdue" class="error-message status-filter-message responsive-button"></p> data-status-filter="duesoon"
data-next-x-days="{{ $nextXDays }}"
class="warning-message status-filter-message responsive-button mr-2"></p>
<p id="info-overdue-tasks"
data-status-filter="overdue"
class="error-message status-filter-message responsive-button"></p>
</div> </div>
</div> </div>
<div class="row mt-3"> <div class="row mt-3">
<div class="col-xs-12 col-md-2 col-xl-1"> <div class="col-xs-12 col-md-2 col-xl-1">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3" href="{{ $U('/task/new') }}"> <a class="btn btn-primary btn-sm responsive-button w-100 mb-3"
href="{{ $U('/task/new') }}">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
@@ -35,17 +43,21 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-filter"></i></span> <span class="input-group-text"><i class="fas fa-filter"></i></span>
</div> </div>
<select class="form-control" id="status-filter"> <select class="form-control"
id="status-filter">
<option value="all">{{ $__t('All') }}</option> <option value="all">{{ $__t('All') }}</option>
<option value="duesoon">{{ $__t('Due soon') }}</option> <option value="duesoon">{{ $__t('Due soon') }}</option>
<option value="overdue">{{ $__t('Overdue') }}</option> <option value="overdue">{{ $__t('Overdue') }}</option>
@@ -54,8 +66,11 @@
</div> </div>
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="form-check custom-control form-control-lg custom-checkbox pt-0"> <div class="form-check custom-control form-control-lg custom-checkbox pt-0">
<input class="form-check-input custom-control-input" type="checkbox" id="show-done-tasks"> <input class="form-check-input custom-control-input"
<label class="form-check-label custom-control-label" for="show-done-tasks"> type="checkbox"
id="show-done-tasks">
<label class="form-check-label custom-control-label"
for="show-done-tasks">
{{ $__t('Show done tasks') }} {{ $__t('Show done tasks') }}
</label> </label>
</div> </div>
@@ -64,7 +79,8 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="tasks-table" class="table table-sm table-striped dt-responsive"> <table id="tasks-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -75,43 +91,60 @@
<th class="d-none">Hidden status</th> <th class="d-none">Hidden status</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
</thead> </thead>
<tbody class="d-none"> <tbody class="d-none">
@foreach($tasks as $task) @foreach($tasks as $task)
<tr id="task-{{ $task->id }}-row" class="@if($task->done == 1) text-muted @endif @if(!empty($task->due_date) && $task->due_date < date('Y-m-d')) table-danger @elseif(!empty($task->due_date) && $task->due_date < date('Y-m-d', strtotime("+$nextXDays days"))) table-warning @endif"> <tr id="task-{{ $task->id }}-row"
class="@if($task->done == 1) text-muted @endif @if(!empty($task->due_date) && $task->due_date < date('Y-m-d')) table-danger @elseif(!empty($task->due_date) && $task->due_date < date('Y-m-d', strtotime("
+$nextXDays
days")))
table-warning
@endif">
<td class="fit-content border-right"> <td class="fit-content border-right">
@if($task->done == 0) @if($task->done == 0)
<a class="btn btn-success btn-sm do-task-button" href="#" data-toggle="tooltip" data-placement="left" title="{{ $__t('Mark task "%s" as completed', $task->name) }}" <a class="btn btn-success btn-sm do-task-button"
href="#"
data-toggle="tooltip"
data-placement="left"
title="{{ $__t('Mark task "%s" as completed', $task->name) }}"
data-task-id="{{ $task->id }}" data-task-id="{{ $task->id }}"
data-task-name="{{ $task->name }}"> data-task-name="{{ $task->name }}">
<i class="fas fa-check"></i> <i class="fas fa-check"></i>
</a> </a>
@else @else
<a class="btn btn-secondary btn-sm undo-task-button" href="#" data-toggle="tooltip" data-placement="left" title="{{ $__t('Undo task "%s"', $task->name) }}" <a class="btn btn-secondary btn-sm undo-task-button"
href="#"
data-toggle="tooltip"
data-placement="left"
title="{{ $__t('Undo task "%s"', $task->name) }}"
data-task-id="{{ $task->id }}" data-task-id="{{ $task->id }}"
data-task-name="{{ $task->name }}"> data-task-name="{{ $task->name }}">
<i class="fas fa-undo"></i> <i class="fas fa-undo"></i>
</a> </a>
@endif @endif
<a class="btn btn-sm btn-danger delete-task-button" href="#" <a class="btn btn-sm btn-danger delete-task-button"
href="#"
data-task-id="{{ $task->id }}" data-task-id="{{ $task->id }}"
data-task-name="{{ $task->name }}"> data-task-name="{{ $task->name }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
<a class="btn btn-info btn-sm" href="{{ $U('/task/') }}{{ $task->id }}"> <a class="btn btn-info btn-sm"
href="{{ $U('/task/') }}{{ $task->id }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
</td> </td>
<td id="task-{{ $task->id }}-name" class="@if($task->done == 1) text-strike-through @endif"> <td id="task-{{ $task->id }}-name"
class="@if($task->done == 1) text-strike-through @endif">
{{ $task->name }} {{ $task->name }}
</td> </td>
<td> <td>
<span>{{ $task->due_date }}</span> <span>{{ $task->due_date }}</span>
<time class="timeago timeago-contextual" datetime="{{ $task->due_date }}"></time> <time class="timeago timeago-contextual"
datetime="{{ $task->due_date }}"></time>
</td> </td>
<td class="d-none"> <td class="d-none">
@if($task->category_id != null) <span>{{ FindObjectInArrayByPropertyValue($taskCategories, 'id', $task->category_id)->name }}</span> @else <span class="font-italic font-weight-light">{{ $__t('Uncategorized') }}</span>@endif @if($task->category_id != null) <span>{{ FindObjectInArrayByPropertyValue($taskCategories, 'id', $task->category_id)->name }}</span> @else <span class="font-italic font-weight-light">{{ $__t('Uncategorized') }}</span>@endif
@@ -120,13 +153,18 @@
@if($task->assigned_to_user_id != null) <span>{{ GetUserDisplayName(FindObjectInArrayByPropertyValue($users, 'id', $task->assigned_to_user_id)) }}</span> @endif @if($task->assigned_to_user_id != null) <span>{{ GetUserDisplayName(FindObjectInArrayByPropertyValue($users, 'id', $task->assigned_to_user_id)) }}</span> @endif
</td> </td>
<td class="d-none"> <td class="d-none">
@if($task->done == 1) text-muted @endif @if(!empty($task->due_date) && $task->due_date < date('Y-m-d')) overdue @elseif(!empty($task->due_date) && $task->due_date < date('Y-m-d', strtotime("+$nextXDays days"))) duesoon @endif @if($task->done == 1) text-muted @endif @if(!empty($task->due_date) && $task->due_date < date('Y-m-d'))
</td> overdue
@elseif(!empty($task->due_date) && $task->due_date < date('Y-m-d',
@include('components.userfields_tbody', array( strtotime("+$nextXDays
'userfields' => $userfields, days")))
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $task->id) duesoon
)) @endif
</td>
@include('components.userfields_tbody',
array( 'userfields'=> $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $task->id)
))
</tr> </tr>
@endforeach @endforeach

View File

@@ -15,15 +15,16 @@
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'tasks_due_soon_days', 'id' => 'tasks_due_soon_days',
'additionalAttributes' => 'data-setting-key="tasks_due_soon_days"', 'additionalAttributes' => 'data-setting-key="tasks_due_soon_days"',
'label' => 'Tasks due soon days', 'label' => 'Tasks due soon days',
'min' => 1, 'min' => 1,
'invalidFeedback' => $__t('This cannot be lower than %s', '1'), 'invalidFeedback' => $__t('This cannot be lower than %s', '1'),
'additionalCssClasses' => 'user-setting-control' 'additionalCssClasses' => 'user-setting-control'
)) ))
<a href="{{ $U('/tasks') }}" class="btn btn-success">{{ $__t('OK') }}</a> <a href="{{ $U('/tasks') }}"
class="btn btn-success">{{ $__t('OK') }}</a>
</div> </div>
</div> </div>
@stop @stop

View File

@@ -10,71 +10,87 @@
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<hr> <hr>
<form id="transfer-form" novalidate> <form id="transfer-form"
novalidate>
@include('components.productpicker', array( @include('components.productpicker', array(
'products' => $products, 'products' => $products,
'barcodes' => $barcodes, 'barcodes' => $barcodes,
'nextInputSelector' => '#location_id_from', 'nextInputSelector' => '#location_id_from',
'disallowAddProductWorkflows' => true 'disallowAddProductWorkflows' => true
)) ))
@php /*@include('components.locationpicker', array( @php /*@include('components.locationpicker', array(
'id' => 'location_from', 'id' => 'location_from',
'locations' => $locations, 'locations' => $locations,
'isRequired' => true, 'isRequired' => true,
'label' => 'Transfer From Location' 'label' => 'Transfer From Location'
))*/ @endphp ))*/ @endphp
<div class="form-group"> <div class="form-group">
<label for="location_id_from">{{ $__t('From location') }}</label> <label for="location_id_from">{{ $__t('From location') }}</label>
<select required class="form-control location-combobox" id="location_id_from" name="location_id_from"> <select required
class="form-control location-combobox"
id="location_id_from"
name="location_id_from">
<option></option> <option></option>
@foreach($locations as $location) @foreach($locations as $location)
<option value="{{ $location->id }}" data-is-freezer="{{ $location->is_freezer }}">{{ $location->name }}</option> <option value="{{ $location->id }}"
data-is-freezer="{{ $location->is_freezer }}">{{ $location->name }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('A location is required') }}</div> <div class="invalid-feedback">{{ $__t('A location is required') }}</div>
</div> </div>
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'amount', 'id' => 'amount',
'label' => 'Amount', 'label' => 'Amount',
'hintId' => 'amount_qu_unit', 'hintId' => 'amount_qu_unit',
'min' => 1, 'min' => 1,
'value' => 1, 'value' => 1,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'), 'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
'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>' '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>'
)) ))
<div class="form-group"> <div class="form-group">
<label for="use_specific_stock_entry"> <label for="use_specific_stock_entry">
<input type="checkbox" id="use_specific_stock_entry" name="use_specific_stock_entry"> {{ $__t('Use a specific stock item') }} <input type="checkbox"
id="use_specific_stock_entry"
name="use_specific_stock_entry"> {{ $__t('Use a specific stock item') }}
<span class="small text-muted">{{ $__t('The first item in this list would be picked by the default rule which is "First expiring first, then first in first out"') }}</span> <span class="small text-muted">{{ $__t('The first item in this list would be picked by the default rule which is "First expiring first, then first in first out"') }}</span>
</label> </label>
<select disabled class="form-control" id="specific_stock_entry" name="specific_stock_entry"> <select disabled
class="form-control"
id="specific_stock_entry"
name="specific_stock_entry">
<option></option> <option></option>
</select> </select>
</div> </div>
@php /*@include('components.locationpicker', array( @php /*@include('components.locationpicker', array(
'locations' => $locations, 'locations' => $locations,
'isRequired' => true, 'isRequired' => true,
'label' => 'Transfer to Location' 'label' => 'Transfer to Location'
))*/ @endphp ))*/ @endphp
<div class="form-group"> <div class="form-group">
<label for="location_id_to">{{ $__t('To location') }}</label> <label for="location_id_to">{{ $__t('To location') }}</label>
<select required class="form-control location-combobox" id="location_id_to" name="location_id_to"> <select required
class="form-control location-combobox"
id="location_id_to"
name="location_id_to">
<option></option> <option></option>
@foreach($locations as $location) @foreach($locations as $location)
<option value="{{ $location->id }}" data-is-freezer="{{ $location->is_freezer }}">{{ $location->name }}</option> <option value="{{ $location->id }}"
data-is-freezer="{{ $location->is_freezer }}">{{ $location->name }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('A location is required') }}</div> <div class="invalid-feedback">{{ $__t('A location is required') }}</div>
</div> </div>
<button id="save-transfer-button" class="btn btn-success">{{ $__t('OK') }}</button> <button id="save-transfer-button"
class="btn btn-success">{{ $__t('OK') }}</button>
</form> </form>
</div> </div>

View File

@@ -13,7 +13,8 @@
<hr> <hr>
<div class="row mt-3"> <div class="row mt-3">
<div class="col-xs-12 col-md-2 col-xl-1"> <div class="col-xs-12 col-md-2 col-xl-1">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3" href="{{ $U('/userentity/new') }}"> <a class="btn btn-primary btn-sm responsive-button w-100 mb-3"
href="{{ $U('/userentity/new') }}">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
@@ -22,16 +23,20 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="userentities-table" class="table table-sm table-striped dt-responsive"> <table id="userentities-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -43,13 +48,18 @@
@foreach($userentities as $userentity) @foreach($userentities as $userentity)
<tr> <tr>
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-info btn-sm" href="{{ $U('/userentity/') }}{{ $userentity->id }}"> <a class="btn btn-info btn-sm"
href="{{ $U('/userentity/') }}{{ $userentity->id }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-danger btn-sm userentity-delete-button" href="#" data-userentity-id="{{ $userentity->id }}" data-userentity-name="{{ $userentity->name }}"> <a class="btn btn-danger btn-sm userentity-delete-button"
href="#"
data-userentity-id="{{ $userentity->id }}"
data-userentity-name="{{ $userentity->name }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
<a class="btn btn-secondary btn-sm" href="{{ $U('/userfields?entity=userentity-') }}{{ $userentity->name }}"> <a class="btn btn-secondary btn-sm"
href="{{ $U('/userfields?entity=userentity-') }}{{ $userentity->name }}">
<i class="fas fa-th-list"></i> {{ $__t('Configure fields') }} <i class="fas fa-th-list"></i> {{ $__t('Configure fields') }}
</a> </a>
</td> </td>

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit userentity')) @section('title', $__t('Edit userentity'))
@else @else
@section('title', $__t('Create userentity')) @section('title', $__t('Create userentity'))
@endif @endif
@section('viewJsName', 'userentityform') @section('viewJsName', 'userentityform')
@@ -17,45 +17,79 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<script>Grocy.EditMode = '{{ $mode }}';</script> <script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $userentity->id }};</script> <script>
Grocy.EditObjectId = {{ $userentity->id }};
</script>
@endif @endif
<form id="userentity-form" novalidate> <form id="userentity-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Name') }}</label> <label for="name">{{ $__t('Name') }}</label>
<input @if($mode == 'edit') disabled @endif type="text" class="form-control" required pattern="^[a-zA-Z0-9]*$" id="name" name="name" value="@if($mode == 'edit'){{ $userentity->name }}@endif"> <input @if($mode=='edit'
)
disabled
@endif
type="text"
class="form-control"
required
pattern="^[a-zA-Z0-9]*$"
id="name"
name="name"
value="@if($mode == 'edit'){{ $userentity->name }}@endif">
<div class="invalid-feedback">{{ $__t('This is required and can only contain letters and numbers') }}</div> <div class="invalid-feedback">{{ $__t('This is required and can only contain letters and numbers') }}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Caption') }}</label> <label for="name">{{ $__t('Caption') }}</label>
<input type="text" class="form-control" required id="caption" name="caption" value="@if($mode == 'edit'){{ $userentity->caption }}@endif"> <input type="text"
class="form-control"
required
id="caption"
name="caption"
value="@if($mode == 'edit'){{ $userentity->caption }}@endif">
<div class="invalid-feedback">{{ $__t('A caption is required') }}</div> <div class="invalid-feedback">{{ $__t('A caption is required') }}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="description">{{ $__t('Description') }}</label> <label for="description">{{ $__t('Description') }}</label>
<textarea class="form-control" rows="2" id="description" name="description">@if($mode == 'edit'){{ $userentity->description }}@endif</textarea> <textarea class="form-control"
rows="2"
id="description"
name="description">@if($mode == 'edit'){{ $userentity->description }}@endif</textarea>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="form-check"> <div class="form-check">
<input type="hidden" name="show_in_sidebar_menu" value="0"> <input type="hidden"
<input @if($mode == 'edit' && $userentity->show_in_sidebar_menu == 1) checked @endif class="form-check-input" type="checkbox" id="show_in_sidebar_menu" name="show_in_sidebar_menu" value="1"> name="show_in_sidebar_menu"
<label class="form-check-label" for="show_in_sidebar_menu">{{ $__t('Show in sidebar menu') }}</label> value="0">
<input @if($mode=='edit'
&&
$userentity->show_in_sidebar_menu == 1) checked @endif class="form-check-input" type="checkbox" id="show_in_sidebar_menu" name="show_in_sidebar_menu" value="1">
<label class="form-check-label"
for="show_in_sidebar_menu">{{ $__t('Show in sidebar menu') }}</label>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Icon CSS class') }}</label> <label for="name">{{ $__t('Icon CSS class') }}</label>
<input type="text" class="form-control" id="icon_css_class" name="icon_css_class" value="@if($mode == 'edit'){{ $userentity->icon_css_class }}@endif" placeholder='{{ $__t('For example') }} "fas fa-smile"'> <input type="text"
class="form-control"
id="icon_css_class"
name="icon_css_class"
value="@if($mode == 'edit'){{ $userentity->icon_css_class }}@endif"
placeholder='{{ $__t('For example') }} "fas fa-smile"'>
</div> </div>
<button id="save-userentity-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-userentity-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit userfield')) @section('title', $__t('Edit userfield'))
@else @else
@section('title', $__t('Create userfield')) @section('title', $__t('Create userfield'))
@endif @endif
@section('viewJsName', 'userfieldform') @section('viewJsName', 'userfieldform')
@@ -17,20 +17,30 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<script>Grocy.EditMode = '{{ $mode }}';</script> <script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $userfield->id }};</script> <script>
Grocy.EditObjectId = {{ $userfield->id }};
</script>
@endif @endif
<form id="userfield-form" novalidate> <form id="userfield-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="entity">{{ $__t('Entity') }}</label> <label for="entity">{{ $__t('Entity') }}</label>
<select required class="form-control" id="entity" name="entity"> <select required
class="form-control"
id="entity"
name="entity">
<option></option> <option></option>
@foreach($entities as $entity) @foreach($entities as $entity)
<option @if($mode == 'edit' && $userfield->entity == $entity) selected="selected" @endif value="{{ $entity }}">{{ $entity }}</option> <option @if($mode=='edit'
&&
$userfield->entity == $entity) selected="selected" @endif value="{{ $entity }}">{{ $entity }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('A entity is required') }}</div> <div class="invalid-feedback">{{ $__t('A entity is required') }}</div>
@@ -38,41 +48,67 @@
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Name') }}</label> <label for="name">{{ $__t('Name') }}</label>
<input type="text" class="form-control" required pattern="^[a-zA-Z0-9]*$" id="name" name="name" value="@if($mode == 'edit'){{ $userfield->name }}@endif"> <input type="text"
class="form-control"
required
pattern="^[a-zA-Z0-9]*$"
id="name"
name="name"
value="@if($mode == 'edit'){{ $userfield->name }}@endif">
<div class="invalid-feedback">{{ $__t('This is required and can only contain letters and numbers') }}</div> <div class="invalid-feedback">{{ $__t('This is required and can only contain letters and numbers') }}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="name">{{ $__t('Caption') }}</label> <label for="name">{{ $__t('Caption') }}</label>
<input type="text" class="form-control" required id="caption" name="caption" value="@if($mode == 'edit'){{ $userfield->caption }}@endif"> <input type="text"
class="form-control"
required
id="caption"
name="caption"
value="@if($mode == 'edit'){{ $userfield->caption }}@endif">
<div class="invalid-feedback">{{ $__t('A caption is required') }}</div> <div class="invalid-feedback">{{ $__t('A caption is required') }}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="type">{{ $__t('Type') }}</label> <label for="type">{{ $__t('Type') }}</label>
<select required class="form-control" id="type" name="type"> <select required
class="form-control"
id="type"
name="type">
<option></option> <option></option>
@foreach($userfieldTypes as $userfieldType) @foreach($userfieldTypes as $userfieldType)
<option @if($mode == 'edit' && $userfield->type == $userfieldType) selected="selected" @endif value="{{ $userfieldType }}">{{ $__t($userfieldType) }}</option> <option @if($mode=='edit'
&&
$userfield->type == $userfieldType) selected="selected" @endif value="{{ $userfieldType }}">{{ $__t($userfieldType) }}</option>
@endforeach @endforeach
</select> </select>
<div class="invalid-feedback">{{ $__t('A type is required') }}</div> <div class="invalid-feedback">{{ $__t('A type is required') }}</div>
</div> </div>
<div class="form-group d-none"> <div class="form-group d-none">
<label for="config">{{ $__t('Configuration') }} <span id="config-hint" class="small text-muted"></span></label> <label for="config">{{ $__t('Configuration') }} <span id="config-hint"
<textarea class="form-control" rows="10" id="config" name="config">@if($mode == 'edit'){{ $userfield->config }}@endif</textarea> class="small text-muted"></span></label>
<textarea class="form-control"
rows="10"
id="config"
name="config">@if($mode == 'edit'){{ $userfield->config }}@endif</textarea>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="form-check"> <div class="form-check">
<input type="hidden" name="show_as_column_in_tables" value="0"> <input type="hidden"
<input @if($mode == 'edit' && $userfield->show_as_column_in_tables == 1) checked @endif class="form-check-input" type="checkbox" id="show_as_column_in_tables" name="show_as_column_in_tables" value="1"> name="show_as_column_in_tables"
<label class="form-check-label" for="show_as_column_in_tables">{{ $__t('Show as column in tables') }}</label> value="0">
<input @if($mode=='edit'
&&
$userfield->show_as_column_in_tables == 1) checked @endif class="form-check-input" type="checkbox" id="show_as_column_in_tables" name="show_as_column_in_tables" value="1">
<label class="form-check-label"
for="show_as_column_in_tables">{{ $__t('Show as column in tables') }}</label>
</div> </div>
</div> </div>
<button id="save-userfield-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-userfield-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>

View File

@@ -14,7 +14,8 @@
<div class="row mt-3"> <div class="row mt-3">
<div class="col-xs-12 col-md-2 col-xl-1"> <div class="col-xs-12 col-md-2 col-xl-1">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3" href="{{ $U('/userfield/new') }}"> <a class="btn btn-primary btn-sm responsive-button w-100 mb-3"
href="{{ $U('/userfield/new') }}">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
@@ -23,20 +24,24 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-filter"></i></span> <span class="input-group-text"><i class="fas fa-filter"></i></span>
</div> </div>
<select class="form-control" id="entity-filter"> <select class="form-control"
id="entity-filter">
<option value="all">{{ $__t('All') }}</option> <option value="all">{{ $__t('All') }}</option>
@foreach($entities as $entity) @foreach($entities as $entity)
<option value="{{ $entity }}">{{ $entity }}</option> <option value="{{ $entity }}">{{ $entity }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
@@ -45,7 +50,8 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="userfields-table" class="table table-sm table-striped dt-responsive"> <table id="userfields-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -59,10 +65,14 @@
@foreach($userfields as $userfield) @foreach($userfields as $userfield)
<tr> <tr>
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-info btn-sm" href="{{ $U('/userfield/') }}{{ $userfield->id }}"> <a class="btn btn-info btn-sm"
href="{{ $U('/userfield/') }}{{ $userfield->id }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-danger btn-sm userfield-delete-button" href="#" data-userfield-id="{{ $userfield->id }}" data-userfield-name="{{ $userfield->name }}"> <a class="btn btn-danger btn-sm userfield-delete-button"
href="#"
data-userfield-id="{{ $userfield->id }}"
data-userfield-name="{{ $userfield->name }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
</td> </td>

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit user')) @section('title', $__t('Edit user'))
@else @else
@section('title', $__t('Create user')) @section('title', $__t('Create user'))
@endif @endif
@section('viewJsName', 'userform') @section('viewJsName', 'userform')
@@ -17,42 +17,69 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<script>Grocy.EditMode = '{{ $mode }}';</script> <script>
Grocy.EditMode = '{{ $mode }}';
</script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $user->id }};</script> <script>
Grocy.EditObjectId = {{ $user->id }};
</script>
@endif @endif
<form id="user-form" novalidate> <form id="user-form"
novalidate>
<div class="form-group"> <div class="form-group">
<label for="username">{{ $__t('Username') }}</label> <label for="username">{{ $__t('Username') }}</label>
<input type="text" class="form-control" required id="username" name="username" value="@if($mode == 'edit'){{ $user->username }}@endif"> <input type="text"
class="form-control"
required
id="username"
name="username"
value="@if($mode == 'edit'){{ $user->username }}@endif">
<div class="invalid-feedback">{{ $__t('A username is required') }}</div> <div class="invalid-feedback">{{ $__t('A username is required') }}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="first_name">{{ $__t('First name') }}</label> <label for="first_name">{{ $__t('First name') }}</label>
<input type="text" class="form-control" id="first_name" name="first_name" value="@if($mode == 'edit'){{ $user->first_name }}@endif"> <input type="text"
class="form-control"
id="first_name"
name="first_name"
value="@if($mode == 'edit'){{ $user->first_name }}@endif">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="last_name">{{ $__t('Last name') }}</label> <label for="last_name">{{ $__t('Last name') }}</label>
<input type="text" class="form-control" id="last_name" name="last_name" value="@if($mode == 'edit'){{ $user->last_name }}@endif"> <input type="text"
class="form-control"
id="last_name"
name="last_name"
value="@if($mode == 'edit'){{ $user->last_name }}@endif">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="password">{{ $__t('Password') }}</label> <label for="password">{{ $__t('Password') }}</label>
<input type="password" class="form-control" required id="password" name="password"> <input type="password"
class="form-control"
required
id="password"
name="password">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="password_confirm">{{ $__t('Confirm password') }}</label> <label for="password_confirm">{{ $__t('Confirm password') }}</label>
<input type="password" class="form-control" required id="password_confirm" name="password_confirm"> <input type="password"
class="form-control"
required
id="password_confirm"
name="password_confirm">
<div class="invalid-feedback">{{ $__t('Passwords do not match') }}</div> <div class="invalid-feedback">{{ $__t('Passwords do not match') }}</div>
</div> </div>
<button id="save-user-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-user-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>

View File

@@ -1,9 +1,9 @@
@extends('layout.default') @extends('layout.default')
@if($mode == 'edit') @if($mode == 'edit')
@section('title', $__t('Edit %s', $userentity->caption)) @section('title', $__t('Edit %s', $userentity->caption))
@else @else
@section('title', $__t('Create %s', $userentity->caption)) @section('title', $__t('Create %s', $userentity->caption))
@endif @endif
@section('viewJsName', 'userobjectform') @section('viewJsName', 'userobjectform')
@@ -24,17 +24,21 @@
</script> </script>
@if($mode == 'edit') @if($mode == 'edit')
<script>Grocy.EditObjectId = {{ $userobject->id }};</script> <script>
Grocy.EditObjectId = {{ $userobject->id }};
</script>
@endif @endif
<form id="userobject-form" novalidate> <form id="userobject-form"
novalidate>
@include('components.userfieldsform', array( @include('components.userfieldsform', array(
'userfields' => $userfields, 'userfields' => $userfields,
'entity' => 'userentity-' . $userentity->name 'entity' => 'userentity-' . $userentity->name
)) ))
<button id="save-userobject-button" class="btn btn-success">{{ $__t('Save') }}</button> <button id="save-userobject-button"
class="btn btn-success">{{ $__t('Save') }}</button>
</form> </form>
</div> </div>

View File

@@ -10,7 +10,8 @@
<div class="title-related-links"> <div class="title-related-links">
<h2 class="title">@yield('title')</h2> <h2 class="title">@yield('title')</h2>
<div class="related-links"> <div class="related-links">
<a class="btn btn-outline-secondary d-print-none" href="{{ $U('/userfields?entity=' . 'userentity-' . $userentity->name) }}"> <a class="btn btn-outline-secondary d-print-none"
href="{{ $U('/userfields?entity=' . 'userentity-' . $userentity->name) }}">
{{ $__t('Configure fields') }} {{ $__t('Configure fields') }}
</a> </a>
</div> </div>
@@ -21,7 +22,8 @@
<hr> <hr>
<div class="row mt-3"> <div class="row mt-3">
<div class="col-xs-12 col-md-2 col-xl-1"> <div class="col-xs-12 col-md-2 col-xl-1">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3" href="{{ $U('/userobject/' . $userentity->name . '/new') }}"> <a class="btn btn-primary btn-sm responsive-button w-100 mb-3"
href="{{ $U('/userobject/' . $userentity->name . '/new') }}">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
@@ -30,22 +32,26 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="userobjects-table" class="table table-sm table-striped dt-responsive"> <table id="userobjects-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right d-print-none"></th> <th class="border-right d-print-none"></th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
)) ))
</tr> </tr>
@@ -54,17 +60,20 @@
@foreach($userobjects as $userobject) @foreach($userobjects as $userobject)
<tr> <tr>
<td class="fit-content border-right d-print-none"> <td class="fit-content border-right d-print-none">
<a class="btn btn-info btn-sm" href="{{ $U('/userobject/' . $userentity->name . '/') }}{{ $userobject->id }}"> <a class="btn btn-info btn-sm"
href="{{ $U('/userobject/' . $userentity->name . '/') }}{{ $userobject->id }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-danger btn-sm userobject-delete-button" href="#" data-userobject-id="{{ $userobject->id }}"> <a class="btn btn-danger btn-sm userobject-delete-button"
href="#"
data-userobject-id="{{ $userobject->id }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
</td> </td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $userobject->id) 'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $userobject->id)
)) ))
</tr> </tr>

View File

@@ -5,9 +5,9 @@
@section('viewJsName', 'userpermissions') @section('viewJsName', 'userpermissions')
@push('pageScripts') @push('pageScripts')
<script> <script>
Grocy.EditObjectId = {{ $user->id }}; Grocy.EditObjectId = {{ $user->id }};
</script> </script>
@endpush @endpush
@section('content') @section('content')
@@ -21,14 +21,16 @@
<div class="col"> <div class="col">
<ul> <ul>
@foreach($permissions as $perm) @foreach($permissions as $perm)
<li> <li>
@include('components.userpermission_select', array( @include('components.userpermission_select', array(
'permission' => $perm 'permission' => $perm
)) ))
</li> </li>
@endforeach @endforeach
</ul> </ul>
<button id="permission-save" class="btn btn-success" type="submit">{{ $__t('Save') }}</button> <button id="permission-save"
class="btn btn-success"
type="submit">{{ $__t('Save') }}</button>
</div> </div>
</div> </div>
@endsection @endsection

View File

@@ -13,7 +13,8 @@
<hr> <hr>
<div class="row mt-3"> <div class="row mt-3">
<div class="col-xs-12 col-md-2 col-xl-1"> <div class="col-xs-12 col-md-2 col-xl-1">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3" href="{{ $U('/user/new') }}"> <a class="btn btn-primary btn-sm responsive-button w-100 mb-3"
href="{{ $U('/user/new') }}">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
</div> </div>
@@ -22,16 +23,20 @@
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search"></i></span> <span class="input-group-text"><i class="fas fa-search"></i></span>
</div> </div>
<input type="text" id="search" class="form-control" placeholder="{{ $__t('Search') }}"> <input type="text"
id="search"
class="form-control"
placeholder="{{ $__t('Search') }}">
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table id="users-table" class="table table-sm table-striped dt-responsive"> <table id="users-table"
class="table table-sm table-striped dt-responsive">
<thead> <thead>
<tr> <tr>
<th class="border-right"></th> <th class="border-right"></th>
@@ -44,13 +49,18 @@
@foreach($users as $user) @foreach($users as $user)
<tr> <tr>
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-info btn-sm" href="{{ $U('/user/') }}{{ $user->id }}"> <a class="btn btn-info btn-sm"
href="{{ $U('/user/') }}{{ $user->id }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</a> </a>
<a class="btn btn-info btn-sm" href="{{ $U('/user/' . $user->id . '/permissions') }}"> <a class="btn btn-info btn-sm"
href="{{ $U('/user/' . $user->id . '/permissions') }}">
<i class="fas fa-lock"></i> <i class="fas fa-lock"></i>
</a> </a>
<a class="btn btn-danger btn-sm user-delete-button @if($user->id == GROCY_USER_ID) disabled @endif" href="#" data-user-id="{{ $user->id }}" data-user-username="{{ $user->username }}"> <a class="btn btn-danger btn-sm user-delete-button @if($user->id == GROCY_USER_ID) disabled @endif"
href="#"
data-user-id="{{ $user->id }}"
data-user-username="{{ $user->username }}">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
</td> </td>

View File

@@ -16,15 +16,21 @@
<div class="form-group"> <div class="form-group">
<label for="locale">{{ $__t('Language') }}</label> <label for="locale">{{ $__t('Language') }}</label>
<select class="form-control user-setting-control" id="locale" data-setting-key="locale"> <select class="form-control user-setting-control"
id="locale"
data-setting-key="locale">
<option value="">{{ $__t('Default') }}</option> <option value="">{{ $__t('Default') }}</option>
@foreach($languages as $lang) @foreach($languages as $lang)
<option value="{{ $lang }}" @if(GROCY_LOCALE == $lang) checked @endif>{{ $__t($lang) }}</option> <option value="{{ $lang }}"
@if(GROCY_LOCALE==$lang)
checked
@endif>{{ $__t($lang) }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
<a href="{{ $U('/') }}" class="btn btn-success link-return">{{ $__t('OK') }}</a> <a href="{{ $U('/') }}"
class="btn btn-success link-return">{{ $__t('OK') }}</a>
</div> </div>
</div> </div>
@stop @stop