Add something for product price tracking (references #22)

This commit is contained in:
Bernd Bestel
2018-07-26 20:27:38 +02:00
parent f4eb5196f7
commit c64eb27ca1
15 changed files with 335 additions and 32 deletions

View File

@@ -1,4 +1,5 @@
@push('componentScripts')
<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>
@endpush
@@ -11,6 +12,11 @@
<strong>{{ $L('Stock quantity unit') }}:</strong> <span id="productcard-product-stock-qu-name"></span><br>
<strong>{{ $L('Stock amount') }}:</strong> <span id="productcard-product-stock-amount"></span> <span id="productcard-product-stock-qu-name2"></span><br>
<strong>{{ $L('Last purchased') }}:</strong> <span id="productcard-product-last-purchased"></span> <time id="productcard-product-last-purchased-timeago" class="timeago timeago-contextual"></time><br>
<strong>{{ $L('Last used') }}:</strong> <span id="productcard-product-last-used"></span> <time id="productcard-product-last-used-timeago" class="timeago timeago-contextual"></time>
<strong>{{ $L('Last used') }}:</strong> <span id="productcard-product-last-used"></span> <time id="productcard-product-last-used-timeago" class="timeago timeago-contextual"></time><br>
<strong>{{ $L('Last price') }}:</strong> <span id="productcard-product-last-price"></span>
<h5 class="mt-3">{{ $L('Price history') }}</h5>
<canvas id="productcard-product-price-history-chart" class="w-100 d-none"></canvas>
<span id="productcard-no-price-data-hint" class="font-italic d-none">{{ $L('No price history available') }}</span>
</div>
</div>

View File

@@ -39,6 +39,7 @@
Grocy.LocalizationStrings = {!! json_encode($localizationStrings) !!};
Grocy.ActiveNav = '@yield('activeNav', '')';
Grocy.Culture = '{{ GROCY_CULTURE }}';
Grocy.Currency = '{{ GROCY_CURRENCY }}';
</script>
</head>

View File

@@ -30,10 +30,16 @@
<div class="form-group">
<label for="amount">{{ $L('Amount') }}&nbsp;&nbsp;<span id="amount_qu_unit" class="small text-muted"></span></label>
<input type="number" class="form-control" id="amount" name="amount" value="1" min="1" required>
<input type="number" class="form-control" id="amount" name="amount" value="1" min="1" step="1.00" required>
<div class="invalid-feedback">{{ $L('The amount cannot be lower than #1', '1') }}</div>
</div>
<div class="form-group">
<label for="price">{{ $L('Price') }}&nbsp;&nbsp;<span id="amount_qu_unit" class="small text-muted">{{ $L('in #1 per purchase quantity unit', GROCY_CURRENCY) }}</span></label>
<input type="number" class="form-control" id="price" name="price" min="0" step="0.01">
<div class="invalid-feedback">{{ $L('The price cannot be lower than #1', '0') }}</div>
</div>
<button id="save-purchase-button" type="submit" class="btn btn-success">{{ $L('OK') }}</button>
</form>