mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
Modularize product picker
This commit is contained in:
18
views/components/productpicker.blade.php
Normal file
18
views/components/productpicker.blade.php
Normal file
@@ -0,0 +1,18 @@
|
||||
@push('componentScripts')
|
||||
<script src="{{ $U('/viewjs/components/productpicker.js', true) }}?v={{ $version }}"></script>
|
||||
@endpush
|
||||
|
||||
@php if(empty($disallowAddProductWorkflows)) { $disallowAddProductWorkflows = false; } @endphp
|
||||
|
||||
<div class="form-group" data-next-input-selector="{{ $nextInputSelector }}" data-disallow-add-product-workflows="{{ BoolToString($disallowAddProductWorkflows) }}">
|
||||
<label for="product_id">{{ $L('Product') }} <i class="fas fa-barcode"></i><span id="barcode-lookup-disabled-hint" class="small text-muted d-none"> Barcode lookup is disabled</span></label>
|
||||
<select class="form-control combobox" id="product_id" name="product_id" required>
|
||||
<option value=""></option>
|
||||
@foreach($products as $product)
|
||||
<option data-additional-searchdata="{{ $product->barcode }}" value="{{ $product->id }}">{{ $product->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<div class="invalid-feedback">{{ $L('You have to select a product') }}</div>
|
||||
<div id="custom-productpicker-error" class="form-text text-danger d-none"></div>
|
||||
<div id="flow-info-addbarcodetoselection" class="form-text text-muted small d-none"><strong><span id="addbarcodetoselection"></span></strong> {{ $L('will be added to the list of barcodes for the selected product on submit') }}</div>
|
||||
</div>
|
@@ -11,16 +11,11 @@
|
||||
|
||||
<form id="consume-form" novalidate>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="product_id">{{ $L('Product') }} <i class="fas fa-barcode"></i></label>
|
||||
<select class="form-control combobox" id="product_id" name="product_id" required>
|
||||
<option value=""></option>
|
||||
@foreach($products as $product)
|
||||
<option data-additional-searchdata="{{ $product->barcode }}" value="{{ $product->id }}">{{ $product->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<div id="product-error" class="invalid-feedback">{{ $L('You have to select a product') }}</div>
|
||||
</div>
|
||||
@include('components.productpicker', array(
|
||||
'products' => $products,
|
||||
'nextInputSelector' => '#amount',
|
||||
'disallowAddProductWorkflows' => true
|
||||
))
|
||||
|
||||
<div class="form-group">
|
||||
<label for="amount">{{ $L('Amount') }} <span id="amount_qu_unit" class="small text-muted"></span></label>
|
||||
|
@@ -11,17 +11,10 @@
|
||||
|
||||
<form id="inventory-form" novalidate>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="product_id">{{ $L('Product') }} <i class="fas fa-barcode"></i><span id="barcode-lookup-disabled-hint" class="small text-muted d-none"> {{ $L('Barcode lookup is disabled') }}</span></label>
|
||||
<select class="form-control combobox" id="product_id" name="product_id" required>
|
||||
<option value=""></option>
|
||||
@foreach($products as $product)
|
||||
<option data-additional-searchdata="{{ $product->barcode }}" value="{{ $product->id }}">{{ $product->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<div class="invalid-feedback">{{ $L('You have to select a product') }}</div>
|
||||
<div id="flow-info-addbarcodetoselection" class="form-text text-muted small d-none"><strong><span id="addbarcodetoselection"></span></strong> {{ $L('will be added to the list of barcodes for the selected product on submit') }}</div>
|
||||
</div>
|
||||
@include('components.productpicker', array(
|
||||
'products' => $products,
|
||||
'nextInputSelector' => '#new_amount'
|
||||
))
|
||||
|
||||
<div class="form-group">
|
||||
<label for="new_amount">{{ $L('New amount') }} <span id="new_amount_qu_unit" class="small text-muted"></span></label>
|
||||
|
@@ -11,17 +11,10 @@
|
||||
|
||||
<form id="purchase-form" novalidate>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="product_id">{{ $L('Product') }} <i class="fas fa-barcode"></i><span id="barcode-lookup-disabled-hint" class="small text-muted d-none"> Barcode lookup is disabled</span></label>
|
||||
<select class="form-control combobox" id="product_id" name="product_id" required>
|
||||
<option value=""></option>
|
||||
@foreach($products as $product)
|
||||
<option data-additional-searchdata="{{ $product->barcode }}" value="{{ $product->id }}">{{ $product->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<div class="invalid-feedback">{{ $L('You have to select a product') }}</div>
|
||||
<div id="flow-info-addbarcodetoselection" class="form-text text-muted small d-none"><strong><span id="addbarcodetoselection"></span></strong> {{ $L('will be added to the list of barcodes for the selected product on submit') }}</div>
|
||||
</div>
|
||||
@include('components.productpicker', array(
|
||||
'products' => $products,
|
||||
'nextInputSelector' => '#best_before_date .datetimepicker-input'
|
||||
))
|
||||
|
||||
@include('components.datetimepicker', array(
|
||||
'id' => 'best_before_date',
|
||||
|
@@ -21,15 +21,10 @@
|
||||
|
||||
<form id="shoppinglist-form" novalidate>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="product_id">{{ $L('Product') }} <i class="fas fa-barcode"></i></label>
|
||||
<select class="form-control combobox" id="product_id" name="product_id" value="@if($mode == 'edit') {{ $listItem->product_id }} @endif">
|
||||
<option value=""></option>
|
||||
@foreach($products as $product)
|
||||
<option @if($mode == 'edit' && $product->id == $listItem->product_id) selected="selected" @endif data-additional-searchdata="{{ $product->barcode }}" value="{{ $product->id }}">{{ $product->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@include('components.productpicker', array(
|
||||
'products' => $products,
|
||||
'nextInputSelector' => '#amount'
|
||||
))
|
||||
|
||||
<div class="form-group">
|
||||
<label for="amount">{{ $L('Amount') }} <span id="amount_qu_unit" class="small text-muted"></span><br><span class="small text-muted">@if($mode == 'edit' && $listItem->amount_autoadded > 0){{ $L('#1 units were automatically added and will apply in addition to the amount entered here', $listItem->amount_autoadded) }}@endif</span></label>
|
||||
|
Reference in New Issue
Block a user