Set location as freezer

This commit is contained in:
Kurt Riddlesperger 2019-12-19 12:18:40 -06:00
parent 93ed344f58
commit dd6b062af4
5 changed files with 19 additions and 1 deletions

View File

@ -3368,6 +3368,9 @@
"description": {
"type": "string"
},
"freezer": {
"type": "integer"
},
"row_created_timestamp": {
"type": "string",
"format": "date-time"
@ -3377,6 +3380,7 @@
"id": "2",
"name": "0",
"description": null,
"freezer": "0",
"row_created_timestamp": "2019-05-02 20:12:25"
}
},
@ -3579,6 +3583,7 @@
"location": {
"id": "4",
"name": "Candy cupboard",
"freezer": "0",
"description": null,
"row_created_timestamp": "2019-05-02 20:12:25"
},

View File

@ -4,6 +4,7 @@
var jsonData = $('#location-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("location-form");
jsonData.freezer = $('#freezer').is(':checked');
if (Grocy.EditMode === 'create')
{

View File

@ -12,7 +12,7 @@
<select class="form-control location-combobox" id="location_id" name="location_id" @if($isRequired) required @endif>
<option value=""></option>
@foreach($locations as $location)
<option value="{{ $location->id }}">{{ $location->name }}</option>
<option value="{{ $location->id }}" data-freezer="{{ $location->freezer }}">{{ $location->name }}</option>
@endforeach
</select>
<div class="invalid-feedback">{{ $__t('You have to select a location') }}</div>

View File

@ -27,6 +27,14 @@
<div class="invalid-feedback">{{ $__t('A name is required') }}</div>
</div>
<div class="form-group">
<div class="form-check">
<input type="hidden" name="freezer" value="0">
<input @if($mode == 'edit' && $location->freezer == 1) checked @endif class="form-check-input" type="checkbox" id="freezer" name="freezer" value="1">
<label class="form-check-label" for="freezer">{{ $__t('Freezer') }}</label>
</div>
</div>
<div class="form-group">
<label for="description">{{ $__t('Description') }}</label>
<textarea class="form-control" rows="2" id="description" name="description">@if($mode == 'edit'){{ $location->description }}@endif</textarea>

View File

@ -33,6 +33,7 @@
<tr>
<th class="border-right"></th>
<th>{{ $__t('Name') }}</th>
<th>{{ $__t('Freezer') }}</th>
<th>{{ $__t('Description') }}</th>
@include('components.userfields_thead', array(
@ -55,6 +56,9 @@
<td>
{{ $location->name }}
</td>
<td>
{{ $location->freezer }}
</td>
<td>
{{ $location->description }}
</td>